architxt.cli.utils#

Functions

load_forest(files, *[, sample, shuffle])

Load a forest from a list of binary files.

save_forest(forest, output)

Serialize and save the forest object to a buffer.

show_metrics(forest, new_forest, schema, tau)

show_schema(schema)

architxt.cli.utils.load_forest(files, *, sample=0, shuffle=False)[source]#

Load a forest from a list of binary files.

Parameters:
  • files (Iterable[Union[str, Path]]) – List of file paths to read and deserialize into a forest.

  • sample (int) – The number of trees to sample from the forest. If 0, the entire forest is loaded.

  • shuffle (bool) – Whether to shuffle the forest after loading.

Return type:

Collection[Tree]

Returns:

A list containing the deserialized forest data.

>>> forest = load_forest(['forest1.pkl', 'forest2.pkl'], sample=100, shuffle=True)
architxt.cli.utils.save_forest(forest, output)[source]#

Serialize and save the forest object to a buffer.

Parameters:
  • forest (Collection[Tree]) – The forest object to be serialized and saved.

  • output (Union[BytesIO, BinaryIO]) – The buffer or file-like object where the forest will be saved.

>>> with open('forest.pkl', 'wb') as f:
...     save_forest(forest, f)
Return type:

None

architxt.cli.utils.show_metrics(forest, new_forest, schema, tau)[source]#
Return type:

None

architxt.cli.utils.show_schema(schema)[source]#
Return type:

None