interpreTS.core package#

Subpackages#

Submodules#

interpreTS.core.feature_extractor module#

class interpreTS.core.feature_extractor.FeatureExtractor(features=None, feature_params=None, window_size=5, stride=1, id_column=None, sort_column=None)#

Bases: object

static available_features()#

Returns a list of all available features.

Returns#

list

List of feature names.

extract_features(data)#

Extract features from a time series dataset.

Parameters#

datapd.DataFrame or pd.Series

The time series data for which features are to be extracted.

Returns#

pd.DataFrame

A DataFrame containing calculated features for each window.

class interpreTS.core.feature_extractor.Features#

Bases: object

ABSOLUTE_ENERGY = 'absolute_energy'#
BINARIZE_MEAN = 'binarize_mean'#
CALCULATE_SEASONALITY_STRENGTH = 'seasonality_strength'#
CROSSING_POINTS = 'crossing_points'#
ENTROPY = 'entropy'#
FLAT_SPOTS = 'flat_spots'#
LENGTH = 'length'#
MEAN = 'mean'#
MISSING_POINTS = 'missing_points'#
PEAK = 'peak'#
SPIKENESS = 'spikeness'#
STABILITY = 'stability'#
STD_1ST_DER = 'std_1st_der'#
TROUGH = 'trough'#
VARIANCE = 'variance'#

interpreTS.core.time_series_data module#

class interpreTS.core.time_series_data.TimeSeriesData(data)#

Bases: object

A class to manage and process time series data.

resample(interval)#

Resample the time series data to a specified interval.

Parameters#

intervalstr

The interval to resample the data, e.g., ‘D’ for daily, ‘H’ for hourly.

Returns#

TimeSeriesData

A new TimeSeriesData object with resampled data.

Examples#

>>> data = pd.Series([1, 2, 3, 4, 5], index=pd.date_range("2023-01-01", periods=5, freq="D"))
>>> ts_data = TimeSeriesData(data)
>>> resampled_data = ts_data.resample("2D")
split(train_size=0.7)#

Split the time series data into training and test sets.

Parameters#

train_sizefloat, optional

The proportion of the data to use for training, by default 0.7.

Returns#

tuple of TimeSeriesData

A tuple containing the training and test sets as TimeSeriesData objects.

Examples#

>>> data = pd.Series([1, 2, 3, 4, 5])
>>> ts_data = TimeSeriesData(data)
>>> train, test = ts_data.split(0.6)

Module contents#