gemseo / mlearning

api module

Machine learning API

The machine learning API provides methods for creating new and loading existing machine learning models. It also provides methods for listing available models and options.

Functions:

create_classification_model(name, data[, ...])

Create a classification model from a learning dataset.

create_clustering_model(name, data[, ...])

Create a clustering model from a learning dataset.

create_mlearning_model(name, data[, transformer])

Create a machine learning algorithm from a learning dataset.

create_regression_model(name, data[, ...])

Create a regression model from a learning dataset.

get_classification_models()

Get available classification models.

get_classification_options(model_name[, ...])

Find the available options for a classification model.

get_clustering_models()

Get available clustering models.

get_clustering_options(model_name[, ...])

Find the available options for clustering model.

get_mlearning_models()

Get available machine learning algorithms.

get_mlearning_options(model_name[, ...])

Find the available options for a machine learning algorithm.

get_regression_models()

Get available regression models.

get_regression_options(model_name[, ...])

Find the available options for a regression model.

import_classification_model(directory)

Import a classification model from a directory.

import_clustering_model(directory)

Import a clustering model from a directory.

import_mlearning_model(directory)

Import a machine learning algorithm from a directory.

import_regression_model(directory)

Import a regression model from a directory.

gemseo.mlearning.api.create_classification_model(name, data, transformer={'inputs': <gemseo.mlearning.transform.scaler.min_max_scaler.MinMaxScaler object>}, **parameters)[source]

Create a classification model from a learning dataset.

Parameters
  • name (str) – The name of the classification algorithm.

  • data (gemseo.core.dataset.Dataset) – The learning dataset.

  • transformer (Optional[Dict[str, gemseo.mlearning.transform.transformer.Transformer]]) –

    The strategies to transform the variables. Values are instances of Transformer while keys are names of either variables or groups of variables. If None, do not transform the variables.

    By default it is set to {‘inputs’: <gemseo.mlearning.transform.scaler.min_max_scaler.MinMaxScaler object at 0x7fcae3ce7370>}.

  • parameters – The parameters of the classification model.

Returns

A classification model.

Return type

gemseo.mlearning.classification.classification.MLClassificationAlgo

gemseo.mlearning.api.create_clustering_model(name, data, transformer=None, **parameters)[source]

Create a clustering model from a learning dataset.

Parameters
  • name (str) – The name of the clustering algorithm.

  • data (gemseo.core.dataset.Dataset) – The learning dataset.

  • transformer (Optional[Dict[str, gemseo.mlearning.transform.transformer.Transformer]]) –

    The strategies to transform the variables. Values are instances of Transformer while keys are names of either variables or groups of variables. If None, do not transform the variables.

    By default it is set to None.

  • parameters – The parameters of the clustering model.

Returns

A clustering model.

Return type

gemseo.mlearning.cluster.cluster.MLClusteringAlgo

gemseo.mlearning.api.create_mlearning_model(name, data, transformer=None, **parameters)[source]

Create a machine learning algorithm from a learning dataset.

Parameters
  • name (str) – The name of the machine learning algorithm.

  • data (gemseo.core.dataset.Dataset) – The learning dataset.

  • transformer (Optional[Dict[str, gemseo.mlearning.transform.transformer.Transformer]]) –

    The strategies to transform the variables. Values are instances of Transformer while keys are names of either variables or groups of variables. If None, do not transform the variables.

    By default it is set to None.

  • parameters – The parameters of the machine learning algorithm.

Returns

A machine learning model.

Return type

gemseo.mlearning.core.ml_algo.MLAlgo

gemseo.mlearning.api.create_regression_model(name, data, transformer={'inputs': <gemseo.mlearning.transform.scaler.min_max_scaler.MinMaxScaler object>, 'outputs': <gemseo.mlearning.transform.scaler.min_max_scaler.MinMaxScaler object>}, **parameters)[source]

Create a regression model from a learning dataset.

Parameters
  • name (str) – The name of the regression algorithm.

  • data (gemseo.core.dataset.Dataset) – The learning dataset.

  • transformer (Optional[Dict[str, gemseo.mlearning.transform.transformer.Transformer]]) –

    The strategies to transform the variables. Values are instances of Transformer while keys are names of either variables or groups of variables. If None, do not transform the variables.

    By default it is set to {‘inputs’: <gemseo.mlearning.transform.scaler.min_max_scaler.MinMaxScaler object at 0x7fcae3d51bb0>, ‘outputs’: <gemseo.mlearning.transform.scaler.min_max_scaler.MinMaxScaler object at 0x7fcae3d51c10>}.

  • parameters – The parameters of the regression model.

Returns

A regression model.

Return type

gemseo.mlearning.regression.regression.MLRegressionAlgo

gemseo.mlearning.api.get_classification_models()[source]

Get available classification models.

Returns

The available classification models.

Return type

List[str]

gemseo.mlearning.api.get_classification_options(model_name, output_json=False, pretty_print=True)[source]

Find the available options for a classification model.

Parameters
  • model_name (str) – The name of the classification model.

  • output_json (bool) –

    Whether to apply JSON format for the schema.

    By default it is set to False.

  • pretty_print (bool) –

    Print the schema in a pretty table.

    By default it is set to True.

Returns

The options schema of the classification model.

Return type

Union[Dict[str, str], str]

gemseo.mlearning.api.get_clustering_models()[source]

Get available clustering models.

Returns

The available clustering models.

Return type

List[str]

gemseo.mlearning.api.get_clustering_options(model_name, output_json=False, pretty_print=True)[source]

Find the available options for clustering model.

Parameters
  • model_name (str) – The name of the clustering model.

  • output_json (bool) –

    Whether to apply JSON format for the schema.

    By default it is set to False.

  • pretty_print (bool) –

    Print the schema in a pretty table.

    By default it is set to True.

Returns

The options schema of the clustering model.

Return type

Union[Dict[str, str], str]

gemseo.mlearning.api.get_mlearning_models()[source]

Get available machine learning algorithms.

Returns

The available machine learning algorithms.

Return type

List[str]

gemseo.mlearning.api.get_mlearning_options(model_name, output_json=False, pretty_print=True)[source]

Find the available options for a machine learning algorithm.

Parameters
  • model_name (str) – The name of the machine learning algorithm.

  • output_json (bool) –

    Whether to apply JSON format for the schema.

    By default it is set to False.

  • pretty_print (bool) –

    Whether to print the schema in a pretty table.

    By default it is set to True.

Returns

The options schema of the machine learning algorithm.

Return type

Union[Dict[str, str], str]

gemseo.mlearning.api.get_regression_models()[source]

Get available regression models.

Returns

The available regression models.

Return type

List[str]

gemseo.mlearning.api.get_regression_options(model_name, output_json=False, pretty_print=True)[source]

Find the available options for a regression model.

Parameters
  • model_name (str) – The name of the regression model.

  • output_json (bool) –

    Whether to apply JSON format for the schema.

    By default it is set to False.

  • pretty_print (bool) –

    Print the schema in a pretty table.

    By default it is set to True.

Returns

The options schema of the regression model.

Return type

Union[Dict[str, str], str]

gemseo.mlearning.api.import_classification_model(directory)[source]

Import a classification model from a directory.

Parameters

directory (Union[str, pathlib.Path]) – The path to the directory.

Returns

A classification model.

Return type

gemseo.mlearning.classification.classification.MLClassificationAlgo

gemseo.mlearning.api.import_clustering_model(directory)[source]

Import a clustering model from a directory.

Parameters

directory (Union[str, pathlib.Path]) – The path to the directory.

Returns

A clustering model.

Return type

gemseo.mlearning.cluster.cluster.MLClusteringAlgo

gemseo.mlearning.api.import_mlearning_model(directory)[source]

Import a machine learning algorithm from a directory.

Parameters

directory (Union[str, pathlib.Path]) – The path to the directory.

Returns

A machine learning model.

Return type

gemseo.mlearning.core.ml_algo.MLAlgo

gemseo.mlearning.api.import_regression_model(directory)[source]

Import a regression model from a directory.

Parameters

directory (Union[str, pathlib.Path]) – The path of the directory.

Returns

A regression model.

Return type

gemseo.mlearning.regression.regression.MLRegressionAlgo