culebra.tools.abc.scripts.TrainerGenerator class

class TrainerGenerator(args: list[str] | None = None)

Bases: GeneratorScript

Construct the generator.

Define the command-line arguments.

Parameters:

args (list[str] | None) – Sequence of command-line arguments to parse. If None (default), arguments are read from sys.argv. This parameter is mainly intended for testing, allowing command-line arguments to be supplied programmatically.

Class attributes

TrainerGenerator.default_max_num_iters = 100

The default number of solutions evaluated each iteration will be fixed according to each particular problem. E.g., the number of features/nodes.

TrainerGenerator.default_num_solutions = None

The default number of solutions evaluated each iteration will be fixed according to each particular problem.

TrainerGenerator.default_trainer_obj = 'trainer.dill.gz'

Default output file for the serialized trainer.

TrainerGenerator.default_training_func_obj = 'training_func.dill.gz'

Default intput file for the serialized training fitness function.

Static methods

static TrainerGenerator.load(filename: str) → Base

Load a serialized object from a file.

Parameters:

filename (str) – The file name.

Returns:

The loaded object

Raises:

Methods

TrainerGenerator.dump(filename: str) → None

Serialize this object and save it to a file.

Parameters:

filename (str) – The file name.

Raises:
TrainerGenerator.generate() → None

Generate the trainer.

TrainerGenerator.parse_args() → None

Parse and validate command-line arguments.

Raises:

SystemExit – If the command-line arguments are invalid or --help is requested.

abstract TrainerGenerator.process() → None

Execute the main processing logic of the script.

Private methods

TrainerGenerator._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]