API Documentation#
Functions#
Convert to Data Series Functions#
This module provides utilities for converting various data formats into time-series compatible structures. These utilities ensure the data is properly formatted and ready for analysis.
- interpreTS.utils.data_conversion.convert_to_time_series(data)[source]#
Convert input data to a TimeSeriesData object.
- Parameters:
data (pd.DataFrame, pd.Series, or np.ndarray) – The data to be converted into a TimeSeriesData object.
- Returns:
An instance of TimeSeriesData wrapping the input data.
- Return type:
- Raises:
TypeError – If the input data is not of type pd.DataFrame, pd.Series, or np.ndarray.
ValueError – If the input data is empty or has invalid dimensions.
Examples
>>> import pandas as pd >>> data = pd.Series([1, 2, 3, 4, 5]) >>> ts_data = convert_to_time_series(data)
Data Manager#
This module handles operations related to managing metadata, feature functions, and validation requirements necessary for extracting features from time-series data.
- interpreTS.utils.data_manager.generate_feature_descriptions(self, extracted_features)[source]#
Generate textual descriptions for extracted features.
- Parameters:
extracted_features (dict) – A dictionary where keys are feature names and values are their calculated values.
- Returns:
A dictionary where keys are feature names and values are textual descriptions.
- Return type:
dict
Data Validation#
This module provides comprehensive functions to ensure that time-series data adheres to the expected format, dimensionality, and integrity. It includes checks for missing values, data type consistency, and other preprocessing requirements.
- interpreTS.utils.data_validation.validate_time_series_data(data, feature_name=None, validation_requirements=None, **kwargs)[source]#
Validate the input time series data against dynamically provided requirements.
- Parameters:
data (pd.Series, pd.DataFrame, or np.ndarray) – The time series data to be validated.
feature_name (str, optional) – The name of the feature to validate.
validation_requirements (dict, optional) – A dictionary specifying the validation requirements for each feature.
**kwargs (dict) – Additional validation parameters (overrides validation_requirements).
- Returns:
True if the data is valid; raises an error otherwise.
- Return type:
bool
- Raises:
TypeError – If data is not a pd.Series, pd.DataFrame, or np.ndarray.
ValueError – If any validation requirement is not met.
Features Loader#
This module enables dynamic loading and management of feature extraction functions available in the library. It provides an interface for accessing and utilizing predefined features.
- class interpreTS.utils.feature_loader.FeatureLoader[source]#
Bases:
object
- class interpreTS.utils.feature_loader.Features[source]#
Bases:
object
- ABOVE_9TH_DECILE = 'above_9th_decile'#
- ABSOLUTE_ENERGY = 'absolute_energy'#
- BELOW_1ST_DECILE = 'below_1st_decile'#
- BINARIZE_MEAN = 'binarize_mean'#
- CHANGE_IN_VARIANCE = 'change_in_variance'#
- CROSSING_POINTS = 'crossing_points'#
- DISTANCE_TO_LAST_TREND_CHANGE = 'distance_to_last_trend_change'#
- DOMINANT = 'dominant'#
- ENTROPY = 'entropy'#
- FLAT_SPOTS = 'flat_spots'#
- HETEROGENEITY = 'heterogeneity'#
- LENGTH = 'length'#
- LINEARITY = 'linearity'#
- MEAN = 'mean'#
- MEAN_CHANGE = 'mean_change'#
- MISSING_POINTS = 'missing_points'#
- OUTLIERS_IQR = 'outliers_iqr'#
- OUTLIERS_STD = 'outliers_std'#
- PEAK = 'peak'#
- SEASONALITY_STRENGTH = 'seasonality_strength'#
- SIGNIFICANT_CHANGES = 'significant_changes'#
- SPIKENESS = 'spikeness'#
- STABILITY = 'stability'#
- STD_1ST_DER = 'std_1st_der'#
- TREND_STRENGTH = 'trend_strength'#
- TROUGH = 'trough'#
- VARIABILITY_IN_SUB_PERIODS = 'variability_in_sub_periods'#
- VARIANCE = 'variance'#
Task Manager#
This module is responsible for orchestrating feature extraction tasks. It includes task generation, validation, execution, and parallelization using various computational backends.
- class interpreTS.utils.task_manager.TaskManager(feature_functions, window_size, features, stride, feature_params, validation_requirements)[source]#
Bases:
object
TaskManager handles feature extraction from time-series data using configurable parameters such as window size, stride, and specific feature functions.
- feature_functions#
A dictionary mapping feature names to their respective calculation functions.
- Type:
dict
- window_size#
Size of the time window for feature extraction, can be a number or a time-based string.
- Type:
int or str
- features#
Names of features to calculate.
- Type:
list of str
- stride#
Stride size for sliding windows during feature extraction.
- Type:
int or str
- feature_params#
Additional parameters for specific feature calculations.
- Type:
dict
- validation_requirements#
Validation requirements for each feature.
- Type:
dict
- warning_registry#
A set to keep track of warnings already issued during feature extraction.
- Type:
set