module neuralforecast.tsdataset
class TimeSeriesLoader
TimeSeriesLoader DataLoader.
Small change to PyTorch’s Data loader. Combines a dataset and a sampler, and provides an iterable over the given dataset.
The class ~torch.utils.data.DataLoader supports both map-style and iterable-style datasets with single- or multi-process loading, customizing loading order and optional automatic batching (collation) and memory pinning.
Args:
dataset: Dataset to load data from.batch_size(int, optional): How many samples per batch to load. Defaults to 1.shuffle(bool, optional): Set to True to have the data reshuffled at every epoch. Defaults to False.sampler(Sampler or Iterable, optional): Defines the strategy to draw samples from the dataset. Can be any Iterable with len implemented. If specified, shuffle must not be specified. Defaults to None.drop_last(bool, optional): Set to True to drop the last incomplete batch. Defaults to False.**kwargs: Additional keyword arguments for DataLoader.
method __init__
property multiprocessing_context
class BaseTimeSeriesDataset
Base class for time series datasets.
Args:
temporal_cols: Column names for temporal features.max_size(int): Maximum size of time series.min_size(int): Minimum size of time series.y_idx(int): Index of target variable.static(Optional): Static features array.static_cols(Optional): Column names for static features.
method __init__
class TimeSeriesDataset
Time series dataset implementation.
Args:
temporal: Temporal data array.temporal_cols: Column names for temporal features.indptr: Index pointers for time series grouping.y_idx(int): Index of target variable.static(Optional): Static features array.static_cols(Optional): Column names for static features.
method __init__
method align
method append
futr_dataset(TimeSeriesDataset): Future dataset to append.
TimeSeriesDataset: Copy of dataset with future observations appended.
ValueError: If datasets have different number of groups.
method from_df
method trim_dataset
dataset: Dataset to trim.left_trim(int, optional): Number of observations to trim from the left. Defaults to 0.right_trim(int, optional): Number of observations to trim from the right. Defaults to 0.
TimeSeriesDataset: Trimmed dataset.
Exception: If trim size exceeds minimum series length.
method update_dataset
class LocalFilesTimeSeriesDataset
Time series dataset that loads data from local files.
Args:
files_ds(List[str]): List of file paths.temporal_cols: Column names for temporal features.id_col(str): Name of ID column.time_col(str): Name of time column.target_col(str): Name of target column.last_times: Last time for each time series.indices: Series indices.max_size(int): Maximum size of time series.min_size(int): Minimum size of time series.y_idx(int): Index of target variable.static(Optional): Static features array.static_cols(Optional): Column names for static features.
method __init__
method from_data_directories
directories: List of directory paths.static_df(Optional): Static features DataFrame.exogs(List, optional): List of exogenous variable names. Defaults to [].id_col(str, optional): Name of ID column. Defaults to “unique_id”.time_col(str, optional): Name of time column. Defaults to “ds”.target_col(str, optional): Name of target column. Defaults to “y”.
LocalFilesTimeSeriesDataset: Dataset created from directories.
class TimeSeriesDataModule
PyTorch Lightning data module for time series datasets.
Args:
dataset(BaseTimeSeriesDataset): Time series dataset.batch_size(int, optional): Batch size for training. Defaults to 32.valid_batch_size(int, optional): Batch size for validation. Defaults to 1024.drop_last(bool, optional): Whether to drop the last incomplete batch. Defaults to False.shuffle_train(bool, optional): Whether to shuffle training data. Defaults to True.**dataloaders_kwargs: Additional keyword arguments for data loaders.
method __init__
property hparams
The collection of hyperparameters saved with :meth:save_hyperparameters. It is mutable by the user. For the frozen set of initial hyperparameters, use :attr:hparams_initial.
Returns:
Mutable hyperparameters dictionary
property hparams_initial
The collection of hyperparameters saved with :meth:save_hyperparameters. These contents are read-only. Manual updates to the saved hyperparameters can instead be performed through :attr:hparams.
Returns:
AttributeDict: immutable initial hyperparameters

