UCRReader#

class anomalearn.reader.time_series.UCRReader.UCRReader(benchmark_location: str | PathLike)#

Bases: IDatasetReader, TSBenchmarkReader

Data reader for UCR benchmark (https://doi.org/10.1109/TKDE.2021.3112126).

The reader loads the txt files from the UCR benchmark and translate them in the default format.

Attributes

__logger#
_all_datasets#

Inherited attributes

_benchmark_location#
_benchmark_path#
_dataset: pd.DataFrame | None#
accepted_formats#

List of methods

_UCRReader__check_parameters()

__getitem__(item)

__len__()

read(path[, file_format, pandas_args])

param path:

It is a path to the txt file containing the time series formatted

List of inherited methods

get_dataframe(*args, **kwargs)

Gets the dataframe of the dataset previously read.

List of inherited decorated methods

get_dataframe(*args, **kwargs)

Gets the dataframe of the dataset previously read.

Methods

_UCRReader__check_parameters()#
__getitem__(item)#
__len__()#
read(path: str | bytes | PathLike | int, file_format: str = 'csv', pandas_args: dict | None = None, *args, **kwargs) UCRReader#
Parameters:
  • path (str or bytes or PathLike or int) – It is a path to the txt file containing the time series formatted as it is formatted in the benchmark or an integer representing the time series to load from the benchmark (indexed from 0).

  • file_format (str, default="csv") – Ignored.

  • pandas_args (dict or None, default=None) – Ignored.

Inherited methods

get_dataframe(*args, **kwargs) DataFrame#

Gets the dataframe of the dataset previously read.

Parameters:
  • args – Not used, present to allow multiple inheritance and signature change.

  • kwargs – Not used, present to allow multiple inheritance and signature change.

Returns:

dataframe – The dataframe of the dataset.

Return type:

DataFrame

Raises:

ValueError – If the dataset has not been read.

Inherited decorated methods

get_dataframe(*args, **kwargs) DataFrame#

Gets the dataframe of the dataset previously read.

Parameters:
  • args – Not used, present to allow multiple inheritance and signature change.

  • kwargs – Not used, present to allow multiple inheritance and signature change.

Returns:

dataframe – The dataframe of the dataset.

Return type:

DataFrame

Raises:

ValueError – If the dataset has not been read.