.. Copyright 2021 IRT Saint-Exupéry, https://www.irt-saintexupery.com This work is licensed under the Creative Commons Attribution-ShareAlike 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. .. _gen_clustering_algos: Clustering algorithms ===================== .. warning:: Some capabilities may require the :ref:`installation ` of |g| with :ref:`all its features ` and some others may depend on :ref:`plugins `. .. warning:: All the features of the wrapped libraries may not be exposed through |g|. .. note:: The algorithm settings can be passed to a function of the form .. code-block:: python function(..., settings_model: AlgorithmSettings | None = None, **settings: Any) either one by one: .. code-block:: python 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: .. code-block:: python settings_model = AlgorithmSettings(setting_name_1=setting_name_1, setting_name_2=setting_name_2, ...) function(..., settings_model=settings_model) .. _GaussianMixture_options: GaussianMixture --------------- Module: :class:`gemseo.mlearning.clustering.algos.gaussian_mixture` .. code-block:: python :caption: Pydantic model of the settings for GaussianMixture from gemseo.settings.mlearning import GaussianMixture_Settings .. raw:: html
Optional settings
  • **n_clusters** : *, optional* The number of clusters of the clustering algorithm. By default it is set to 5. .. raw:: html
  • **parameters** : *collections.abc.Mapping[str, typing.Any], optional* Other parameters. By default it is set to {}. .. raw:: html
  • **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. .. raw:: html
  • **transformer** : *collections.abc.Mapping[str, typing.Any], optional* The strategies to transform the variables. The values are instances of :class:`.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 :class:`.BaseTransformer` will be applied to all the variables of this group. If :attr:`.IDENTITY`, do not transform the variables. By default it is set to {}. .. raw:: html
  • **var_names** : *collections.abc.Sequence[str], optional* The names of the variables. By default it is set to (). .. raw:: html
.. _KMeans_options: KMeans ------ Module: :class:`gemseo.mlearning.clustering.algos.kmeans` .. code-block:: python :caption: Pydantic model of the settings for KMeans from gemseo.settings.mlearning import KMeans_Settings .. raw:: html
Optional settings
  • **n_clusters** : *, optional* The number of clusters of the clustering algorithm. By default it is set to 5. .. raw:: html
  • **parameters** : *collections.abc.Mapping[str, typing.Any], optional* Other parameters. By default it is set to {}. .. raw:: html
  • **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. .. raw:: html
  • **transformer** : *collections.abc.Mapping[str, typing.Any], optional* The strategies to transform the variables. The values are instances of :class:`.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 :class:`.BaseTransformer` will be applied to all the variables of this group. If :attr:`.IDENTITY`, do not transform the variables. By default it is set to {}. .. raw:: html
  • **var_names** : *collections.abc.Sequence[str], optional* The names of the variables. By default it is set to (). .. raw:: html