gemseo / mlearning / core

factory module

The factory to create the machine learning algorithms.

This module contains a factory to instantiate a MLAlgo from its class name. This factory also provides a list of available machine learning algorithms and allows testing if a machine learning algorithm is available.

class gemseo.mlearning.core.factory.MLAlgoFactory[source]

Bases: object

This factory instantiates a MLAlgo from its class name.

The class can be either internal or external. In this second case, it can be either implemented in a module referenced in the GEMSEO_PATH or in a module The class can be either internal or external. In the second case, it can be either implemented in a module referenced in the GEMSEO_PATH environment variable or in a module starting with gemseo_ and referenced in the PYTHONPATH environment variable.

create(ml_algo, **options)[source]

Create an instance of a machine learning algorithm.

Parameters:
  • ml_algo (str) – The name of a machine learning algorithm (its class name).

  • **options (Dataset | TransformerType | MLAlgoParameterType | None) – The options of the machine learning algorithm.

Returns:

The instance of the machine learning algorithm.

Return type:

MLAlgo

is_available(ml_algo)[source]

Check the availability of a machine learning algorithm.

Parameters:

ml_algo (str) – The name of a machine learning algorithm (its class name).

Returns:

Whether the machine learning algorithm is available.

Return type:

bool

load(directory)[source]

Load an instance of machine learning algorithm from the disk.

Parameters:

directory (str | Path) – The name of the directory containing an instance of a machine learning algorithm.

Returns:

The instance of the machine learning algorithm.

Return type:

MLAlgo

property models: list[str]

The available machine learning algorithms.