culebra.tools.abc.scripts.TrainingTestDataGenerator class

class TrainingTestDataGenerator(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.

Static methods

static TrainingTestDataGenerator.load(filename: str) → Base

Load a serialized object from a file.

Parameters:

filename (str) – The file name.

Returns:

The loaded object

Raises:

Methods

TrainingTestDataGenerator.dump(filename: str) → None

Serialize this object and save it to a file.

Parameters:

filename (str) – The file name.

Raises:
TrainingTestDataGenerator.generate() → None

Generate the training and test data files.

abstract TrainingTestDataGenerator.get_dataset() → Dataset

Get and validate the dataset.

Subclasses must implement this method to get a concrete dataset.

Returns:

The dataset.

Return type:

Dataset

Raises:

ValueError – If the dataset does not match the expected number of features, samples, or classes.

TrainingTestDataGenerator.parse_args() → None

Parse and validate command-line arguments.

Raises:

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

TrainingTestDataGenerator.process() → None

Process the dataset.

Get the dataset, remove missing values, scale features, split the dataset into training and test sets, remove outliers from the training set, balance the training set through oversampling and save both datasets.

Private methods

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