An API for machine learning#

Machine learning functionalities.

This module proposes many high-level functions for creating and loading machine learning models.

gemseo.mlearning.create_classification_model(name, data, transformer=mappingproxy({'inputs': <gemseo.mlearning.transformers.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 (IODataset) -- The learning dataset.

  • transformer (TransformerType) --

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

    By default it is set to {'inputs': <gemseo.mlearning.transformers.scaler.min_max_scaler.MinMaxScaler object at 0x7fddbe694f70>}.

  • parameters -- The parameters of the classification model.

Returns:

A classification model.

Return type:

BaseClassifier

gemseo.mlearning.create_clustering_model(name, data, transformer=mappingproxy({}), **parameters)[source]

Create a clustering model from a learning dataset.

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

  • data (Dataset) -- The learning dataset.

  • transformer (TransformerType) --

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

    By default it is set to {}.

  • parameters -- The parameters of the clustering model.

Returns:

A clustering model.

Return type:

BaseClusterer

gemseo.mlearning.create_mlearning_model(name, data, transformer=mappingproxy({}), **parameters)[source]

Create a machine learning algorithm from a learning dataset.

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

  • data (Dataset) -- The learning dataset.

  • transformer (TransformerType) --

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

    By default it is set to {}.

  • parameters -- The parameters of the machine learning algorithm.

Returns:

A machine learning model.

Return type:

BaseMLAlgo

gemseo.mlearning.create_regression_model(name, data, transformer=mappingproxy({'inputs': <gemseo.mlearning.transformers.scaler.min_max_scaler.MinMaxScaler object>, 'outputs': <gemseo.mlearning.transformers.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 (IODataset) -- The learning dataset.

  • transformer (TransformerType) --

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

    By default it is set to {'inputs': <gemseo.mlearning.transformers.scaler.min_max_scaler.MinMaxScaler object at 0x7fddbe6011f0>, 'outputs': <gemseo.mlearning.transformers.scaler.min_max_scaler.MinMaxScaler object at 0x7fddbe601400>}.

  • parameters -- The parameters of the regression model.

Returns:

A regression model.

Return type:

BaseRegressor

gemseo.mlearning.get_classification_models()[source]

Get available classification models.

Returns:

The available classification models.

Return type:

list[str]

gemseo.mlearning.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:

dict[str, str] | str

gemseo.mlearning.get_clustering_models()[source]

Get available clustering models.

Returns:

The available clustering models.

Return type:

list[str]

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

Find the available options for a 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:

dict[str, str] | str

gemseo.mlearning.get_mlearning_models()[source]

Get available machine learning algorithms.

Returns:

The available machine learning algorithms.

Return type:

list[str]

gemseo.mlearning.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:

dict[str, str] | str

gemseo.mlearning.get_regression_models()[source]

Get available regression models.

Returns:

The available regression models.

Return type:

list[str]

gemseo.mlearning.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:

dict[str, str] | str