RADAR.time_series

Subpackages

Submodules

RADAR.time_series.time_series_datasets_uci module

RADAR.time_series.time_series_datasets_uci.global_load(name_dataset)[source]

Loads a dataset using the corresponding loading method and parameters.

Parameters: name_dataset (str): The name of the dataset to be loaded.

Returns: The dataset loaded using the corresponding method.

RADAR.time_series.time_series_datasets_uci.load_from_id(id)[source]

Fetches a dataset from the UCI repository using its ID.

Parameters: id (int): The identifier of the dataset in the UCI repository.

Returns: tuple: A tuple containing:

  • X (pd.DataFrame): The feature matrix.

  • y (pd.Series or np.array): The target variable.

RADAR.time_series.time_series_datasets_uci.load_from_url(url, **kwargs)[source]

Loads a dataset from a given URL.

Parameters: url (str): The URL from which to fetch the dataset. **kwargs: Additional arguments to be passed to pd.read_csv().

Returns: pd.DataFrame: The dataset loaded from the URL.

RADAR.time_series.time_series_datasets_uci.load_from_zip_url(url, filename, **kwargs)[source]

Loads a specific file from a ZIP archive hosted at a given URL. The function supports handling different file types inside the ZIP, including nested ZIP files. If the file inside the ZIP is another ZIP, it will extract that nested ZIP and load the file inside it. If the file is a CSV or an Excel file, it will load it into a Pandas DataFrame.

Parameters: url (str): The URL from which to fetch the ZIP archive containing the dataset. filename (str): The name of the file inside the ZIP archive to be loaded. This file can be in CSV, Excel (.xlsx), or ZIP format. **kwargs: Additional arguments to be passed to pd.read_csv() or pd.read_excel(), depending on the file format. These arguments can include parameters like sep, header, index_col, etc., for CSV files or sheet_name, dtype, etc., for Excel files.

Returns: DataFrame: A Pandas DataFrame containing the dataset loaded from the specified file.

Behavior: - If the file inside the ZIP is another ZIP file, the function will open the nested ZIP and attempt to load its contents. - If the file is a CSV (identified by the .csv extension), it will be read using pandas.read_csv(). - If the file is an Excel file (identified by the .xlsx extension), it will be read using pandas.read_excel(). - If the file is of an unsupported format, the function raises a ValueError.

RADAR.time_series.time_series_datasets_uci.load_gas_sensor_dataset(url, filename, **kwargs)[source]

Loads multiple CSV files from a nested ZIP archive hosted at a given URL, and combines them into a single DataFrame, preserving the timestamp for each file.

Parameters: url (str): The URL from which to fetch the ZIP dataset. filename (str): The name of the file inside the ZIP archive that might contain another ZIP. **kwargs: Additional arguments to be passed to pd.read_csv().

Returns: pd.DataFrame: A combined DataFrame with all the CSV files inside the nested ZIP archive.

RADAR.time_series.time_series_utils module

class RADAR.time_series.time_series_utils.TimeSeriesDatasetV2(*args: Any, **kwargs: Any)[source]

Bases: Dataset

class RADAR.time_series.time_series_utils.TimeSeriesProcessor(window_size, step_size, future_prediction=False, n_pred=None)[source]

Bases: object

create_windows(X, y, labels=None)[source]

Generates sliding windows from the time series.

X:

Input time series (feature matrix).

Y:

Labels or target values to predict.

Labels:

Additional labels (only used for future prediction).

Returns:

Arrays of input windows, output windows, and labels (if applicable).

process_train_test(X_train, y_train, X_test, y_test, l_test=None)[source]

Generates sliding windows for training and testing sets.

X_train:

Training input data.

Y_train:

Training labels.

X_test:

Testing input data.

Y_test:

Testing labels.

L_test:

Additional labels for the test set (if applicable).

Returns:

Training and testing windows as arrays.

class RADAR.time_series.time_series_utils.TimeseriesDataset(*args: Any, **kwargs: Any)[source]

Bases: Dataset

Module contents