Classification algorithms#

Warning

Some capabilities may require the installation of GEMSEO with all its features and some others may depend on plugins.

Warning

All the features of the wrapped libraries may not be exposed through GEMSEO.

Note

The algorithm settings can be passed to a function of the form

function(..., settings_model: AlgorithmSettings | None = None, **settings: Any)

either one by one:

function(..., setting_name_1=setting_name_1, setting_name_2=setting_name_2, ...)

or using the argument name "settings_model" and the Pydantic model associated with the algorithm:

settings_model = AlgorithmSettings(setting_name_1=setting_name_1, setting_name_2=setting_name_2, ...)
function(..., settings_model=settings_model)

KNNClassifier#

Module: gemseo.mlearning.classification.algos.knn

Pydantic model of the settings for KNNClassifier#
from gemseo.settings.mlearning import KNNClassifier_Settings
Optional settings
  • input_names : collections.abc.Sequence[str], optional

    The names of the input variables

    By default it is set to ().

  • n_neighbors : <class 'int'>, optional

    The number of neighbors.

    By default it is set to 5.

  • output_names : collections.abc.Sequence[str], optional

    The names of the output variables

    By default it is set to ().

  • parameters : collections.abc.Mapping[str, typing.Any], optional

    Other parameters.

    By default it is set to {}.

  • transformer : collections.abc.Mapping[str, typing.Any], optional

    The strategies to transform the variables.

    The values are instances of BaseTransformer while the keys are the names of either the variables or the groups of variables, e.g. "inputs" or "outputs" in the case of the regression algorithms. If a group is specified, the BaseTransformer will be applied to all the variables of this group. If IDENTITY, do not transform the variables.

    By default it is set to {}.

RandomForestClassifier#

Module: gemseo.mlearning.classification.algos.random_forest

Pydantic model of the settings for RandomForestClassifier#
from gemseo.settings.mlearning import RandomForestClassifier_Settings
Optional settings
  • input_names : collections.abc.Sequence[str], optional

    The names of the input variables

    By default it is set to ().

  • n_estimators : <class 'int'>, optional

    The number of trees in the forest.

    By default it is set to 100.

  • output_names : collections.abc.Sequence[str], optional

    The names of the output variables

    By default it is set to ().

  • parameters : collections.abc.Mapping[str, typing.Any], optional

    Other parameters.

    By default it is set to {}.

  • random_state : typing.Optional[typing.Annotated[int, Ge(ge=0)]], optional

    The random state parameter.

    If None, use the global random state instance from numpy.random. Creating the model multiple times will produce different results. If int, use a new random number generator seeded by this integer. This will produce the same results.

    By default it is set to 0.

  • transformer : collections.abc.Mapping[str, typing.Any], optional

    The strategies to transform the variables.

    The values are instances of BaseTransformer while the keys are the names of either the variables or the groups of variables, e.g. "inputs" or "outputs" in the case of the regression algorithms. If a group is specified, the BaseTransformer will be applied to all the variables of this group. If IDENTITY, do not transform the variables.

    By default it is set to {}.

SVMClassifier#

Module: gemseo.mlearning.classification.algos.svm

Pydantic model of the settings for SVMClassifier#
from gemseo.settings.mlearning import SVMClassifier_Settings
Optional settings
  • C : <class 'float'>, optional

    The inverse L2 regularization parameter.

    By default it is set to 1.0.

  • input_names : collections.abc.Sequence[str], optional

    The names of the input variables

    By default it is set to ().

  • kernel : typing.Union[str, typing.Annotated[typing.Callable, WithJsonSchema(json_schema={}, mode=None)]], optional

    The name of the kernel or a callable for the SVM.

    Examples of names: "linear", "poly", "rbf", "sigmoid", "precomputed".

    By default it is set to rbf.

  • output_names : collections.abc.Sequence[str], optional

    The names of the output variables

    By default it is set to ().

  • parameters : collections.abc.Mapping[str, typing.Any], optional

    Other parameters.

    By default it is set to {}.

  • probability : <class 'bool'>, optional

    Whether to enable the probability estimates.

    By default it is set to False.

  • random_state : typing.Optional[typing.Annotated[int, Ge(ge=0)]], optional

    The random state parameter.

    If None, use the global random state instance from numpy.random. Creating the model multiple times will produce different results. If int, use a new random number generator seeded by this integer. This will produce the same results.

    By default it is set to 0.

  • transformer : collections.abc.Mapping[str, typing.Any], optional

    The strategies to transform the variables.

    The values are instances of BaseTransformer while the keys are the names of either the variables or the groups of variables, e.g. "inputs" or "outputs" in the case of the regression algorithms. If a group is specified, the BaseTransformer will be applied to all the variables of this group. If IDENTITY, do not transform the variables.

    By default it is set to {}.