culebra.tools.decision_manager.LexicographicWithRepeatedCVDM class

class LexicographicWithRepeatedCVDM(trainer: Trainer, obj_thresholds: float | None = None, cv_repeats: int | None = None)

Bases: LexicographicDM

Init the decesion manager.

Parameters:

Class methods

classmethod LexicographicWithRepeatedCVDM.load(filename: str) Base

Load a serialized object from a file.

Parameters:

filename (str) – The file name.

Returns:

The loaded object

Raises:

Properties

property LexicographicWithRepeatedCVDM.cv_repeats: int

Number of cross-validation repeats.

Return type:

int

Setter:

Set a new value for the number of cross-validation repeats

Parameters:

value (int) – A positive integer value. If set to None, _default_cv_repeats is assumed

Raises:
property LexicographicWithRepeatedCVDM.obj_thresholds: tuple[float]

Objective similarity thresholds.

Return type:

tuple[float]

Setter:

Set new thresholds.

Parameters:

values (float | Sequence[float]) – The new values. If only a single value is provided, the same threshold will be used for all the objectives. Different thresholds can be provided in a Sequence. If set to None, all the thresholds are set to _default_similarity_threshold

Raises:
  • TypeError – If neither a real number nor a Sequence of real numbers is provided

  • ValueError – If any value is negative

  • ValueError – If the length of the thresholds sequence does not match the number of objectives

Private properties

property LexicographicWithRepeatedCVDM._default_cv_repeats: int

Default number of repeats for cross-validation.

Returns:

DEFAULT_CV_REPEATS

Return type:

int

property LexicographicWithRepeatedCVDM._default_similarity_threshold: float

Default similarity threshold for fitnesses.

Returns:

DEFAULT_SIMILARITY_THRESHOLD

Return type:

float

Methods

LexicographicWithRepeatedCVDM.dump(filename: str) None

Serialize this object and save it to a file.

Parameters:

filename (str) – The file name.

Raises:
LexicographicWithRepeatedCVDM.select() tuple[Solution, ...] | None

Select a solution from the trainer’s best ones.

Returns:

The chosen solution

Return type:

tuple[Solution, …]

Private methods

LexicographicWithRepeatedCVDM._choose(all_combinations: list[list[Solution, ...]], all_combinations_fitness: list[Fitness, ...]) tuple[Solution, ...] | None

Choose one combination of solutions.

The combinations are ranked lexicographically and the first one is selected.

Parameters:

all_combinations (list[list[Solution, ...]]) – All the combinations of the Pareto optimal solutions from each species

All_combinations_fitness:

The fitness for each combination

Returns:

The chosen combination

Return type:

tuple[Solution, …]

LexicographicWithRepeatedCVDM._evaluate(all_combinations: list[list[Solution, ...]]) list[Fitness, ...]

Evaluate all the combinations of Pareto optimal solutions.

The trainer’s training fitness function is used to perform a repeated cross-validaton process.

Parameters:

all_combinations (list[list[Solution, ...]]) – All the combinations of the Pareto optimal solutions from each species

Returns:

The fitness for each combination

Return type:

list[Fitness, …]

LexicographicWithRepeatedCVDM._generate_all_combinations() list[list[Solution, ...]]

Generate all the combinations of Pareto optimal solutions.

Returns:

The combinations

Return type:

list[list[Solution, …]]

LexicographicWithRepeatedCVDM._get_repr_properties() dict[str, object]

Return the subset of properties used for __repr__.

Filters and evaluates all class-level @property attributes, returning only those intended for representation purposes. Private properties (names starting with _) are excluded.

Returns:

Mapping of property names to their corresponding values.

Return type:

dict[str, object]