gemseo / mlearning / core

factory module

Machine learning algorithm factory

This module contains a factory to instantiate a MLAlgo from its class name. The class can be internal to GEMSEO or located in an external module whose path is provided to the constructor. It also provides a list of available machine learning algorithm types and allows you to test if a machine learning algorithm type is available.

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

Bases: object

This factory instantiates a MLAlgo from its class name. The class can be internal to GEMSEO or located in an external module whose path is provided to the constructor.

Initializes the factory: scans the directories to search for subclasses of MLAlgo. Searches in “GEMSEO_PATH” and gemseo.mlearning.

create(ml_algo, **options)[source]

Create machine learning algorithm.

Parameters
  • ml_algo (str) – name of the machine learning algorithm (its classname).

  • options – machine learning algorithm options.

Returns

MLAlgo

is_available(ml_algo)[source]

Checks the availability of a cache.

Parameters

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

Returns

True if the machine learning algorithm is available.

Return type

bool

load(directory)[source]

Load a machine learning algorithm from the disk.

Parameters

directory (str) – directory name.

property models

Lists the available classes.

Returns

list of class names.

Return type

list(str)