Space

class sklearn_genetic.space.Categorical(choices: list | None = None, priors: list | None = None, distribution: str = 'choice', random_state=None)[source]

class for hyperparameters search space of categorical values

Parameters:
choices: list, default=None

List with all the possible values of the hyperparameter.

priors: int, default=None

List with the probability of sampling each element of the “choices”, if not set gives equals probability.

distribution: str, default=’choice’

Distribution to sample initial population and mutation values, currently only supports “choice”.

random_stateint or None, RandomState instance, default=None

Pseudo random number generator state used for random dimension sampling.

sample()[source]

Sample a random value from the assigned distribution

class sklearn_genetic.space.Continuous(lower: float | None = None, upper: float | None = None, distribution: str = 'uniform', random_state=None)[source]

class for hyperparameters search space of real values

Parameters:
lowerint, default=None

Lower bound of the possible values of the hyperparameter.

upperint, default=None

Upper bound of the possible values of the hyperparameter.

distribution{‘uniform’, ‘log-uniform’}, default=’uniform’

Distribution to sample initial population and mutation values.

random_stateint or None, RandomState instance, default=None

Pseudo random number generator state used for random dimension sampling.

sample()[source]

Sample a random value from the assigned distribution

class sklearn_genetic.space.Integer(lower: int | None = None, upper: int | None = None, distribution: str = 'uniform', random_state=None)[source]

class for hyperparameters search space of integer values

Parameters:
lowerint, default=None

Lower bound of the possible values of the hyperparameter.

upperint, default=None

Upper bound of the possible values of the hyperparameter.

distributionstr, default=”uniform”

Distribution to sample initial population and mutation values, currently only supports ‘uniform’.

random_stateint or None, RandomState instance, default=None

Pseudo random number generator state used for random dimension sampling.

sample()[source]

Sample a random value from the assigned distribution

class sklearn_genetic.space.Space(param_grid: dict | None = None)[source]

Search space for all the models hyperparameters

Parameters:
param_grid: dict, default=None

Grid with the parameters to tune, expects keys a valid name of hyperparameter based on the estimator selected and as values one of Integer , Categorical Continuous classes

property dimensions
Returns:
The number of hyperparameters defined in the param_grid
property parameters
Returns:
A list with all the names of the hyperparametes in the param_Grid