commonpower.data_forecasting.nn_forecasting.data_splitting.SimpleFractionalSplit

class SimpleFractionalSplit(split_type: DataSplitType, data_source: DataSource, model: NNModule, train_fraction: float = 0.7, val_fraction: float = 0.15)[source]

Bases: DatasetSplit

The SimpleFractionalSplit splits the dataset into training, validation, and test sets based on fractions. The split is done in order of the data source (generally date). If train_fraction + val_fraction < 1, the remaining data is used for testing.

Parameters:
  • split_type (DataSplitType) – The type of data splitting.

  • data_source (DataSource) – The data source.

  • model (NNModule) – The neural network model.

  • train_fraction (float, optional) – The fraction of the data to use for training. Defaults to 0.7.

  • val_fraction (float, optional) – The fraction of the data to use for validation. Defaults to 0.15.

Returns:

DatasetSplit – The initialized DatasetSplit object.

Methods

adjust_index

Adjusts the index to the correct position in the dataset.

adjust_index(idx: int) int[source]

Adjusts the index to the correct position in the dataset.

Parameters:

idx (int) – Index.

Returns:

int – Adjusted index.