misc#

Functions#

capymoa.misc.legacy_load_model(filename)[source]#

Load a model from a file.

Use load_model() if possible.

Parameters:

filename – The file to load the model from.

capymoa.misc.legacy_save_model(model, filename)[source]#

Save a model to a file.

Use save_model() if possible.

Parameters:
  • model – The model to save.

  • filename – The file to save the model to.

capymoa.misc.load_model(file: BinaryIO) object[source]#

Load a model from a jpype pickle file.

If you are trying to load a model saved with a version of CapyMOA < 0.8.2, use legacy_load_model() and save_model() to reformat the model.

See also: save_model().

Parameters:

file – The file-like object to load the model from.

Returns:

The loaded model.

capymoa.misc.save_model(model: object, file: BinaryIO) None[source]#

Save a model to a jpype pickle file.

>>> from capymoa.classifier import AdaptiveRandomForestClassifier
>>> from capymoa.datasets import ElectricityTiny
>>> from tempfile import TemporaryFile
>>> stream = ElectricityTiny()
>>> learner = AdaptiveRandomForestClassifier(schema=stream.get_schema())
>>> with TemporaryFile() as fd:
...     save_model(learner, fd)

See https://jpype.readthedocs.io/en/latest/api.html#jpype-pickle-module for more information.

Parameters:
  • model – A python object optionally containing Java objects.

  • file – The file-like object to save the model to.