culebra.fitness_function.cooperative.FSSVCScorer class

class FSSVCScorer(*objectives: tuple[SingleObjectiveFitnessFunction, ...])

Bases: MultiObjectiveFitnessFunction

Construct a cooperative multi-objective fitness function.

All the objectives that analyze a dataset must be FSClassificationScorer instances using an SVC with RBF kernels. That is, no RBFSVCScorer objectives are allowed.

Parameters:

objectives (tuple[SingleObjectiveFitnessFunction]) – Objectives for this fitness function

Class methods

classmethod FSSVCScorer.load(filename: str) Base

Load a serialized object from a file.

Parameters:

filename (str) – The file name.

Returns:

The loaded object

Raises:

Properties

property FSSVCScorer.fitness_cls: type[Fitness]

Fitness class.

Return type:

type[Fitness]

property FSSVCScorer.num_obj: int

Number of objectives.

Return type:

int

property FSSVCScorer.obj_names: tuple[str, ...]

Objective names.

Return type:

tuple[str]

property FSSVCScorer.obj_thresholds: list[float]

Objective similarity thresholds.

Return type:

list[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

property FSSVCScorer.obj_weights: tuple[int, ...]

Objective weights.

Return type:

tuple[int]

property FSSVCScorer.objectives: tuple[SingleObjectiveFitnessFunction]

Objectives to be optimized.

Return type:

tuple[SingleObjectiveFitnessFunction]

Private properties

property FSSVCScorer._default_similarity_threshold: float

Default similarity threshold for fitnesses.

Returns:

DEFAULT_SIMILARITY_THRESHOLD

Return type:

float

Methods

FSSVCScorer.construct_solutions(sol: Solution, index: int | None = None, representatives: Sequence[Solution] | None = None) tuple[Solution, ...]

Assemble the solution and representatives.

This fitness function assumes that:

Parameters:
  • sol (Solution) – Solution to be evaluated.

  • index (int) – Index where sol should be inserted in the representatives sequence to form a complete solution for the problem

  • representatives (Sequence[Solution]) – Representative solutions of each species being optimized, ignored

Returns:

The solutions to the different problems solved cooperatively

Return type:

tuple[culebra.abc.Solution]

FSSVCScorer.dump(filename: str) None

Serialize this object and save it to a file.

Parameters:

filename (str) – The file name.

Raises:
FSSVCScorer.evaluate(sol: Solution, index: int | None = None, representatives: Sequence[Solution] | None = None) Fitness

Evaluate a solution.

It is assumed that:

Parameters:
  • sol (Solution) – Solution to be evaluated.

  • index (int) – Index where sol should be inserted in the representatives sequence to form a complete solution for the problem, optional

  • representatives (Sequence[Solution]) – Representative solutions of each species being optimized, optional

Returns:

The fitness for sol

Return type:

Fitness