API Reference
Introduction
This document provides a detailed reference for the ete_ts
library API. It covers installation, basic usage, and a complete guide to all available functions for time-series feature extraction.
Installation
Install the library from PyPI using pip:
Basic Usage
To get started, import the library and a numerical package like NumPy. Then you can call any feature-extraction function with your time-series data.
import ete_ts
import numpy as np
# Create a sample time-series
my_series = np.array([1, 2, 4, 8, 12, 18, 25, 33, 45, 58])
# Calculate a feature
slope = ete_ts.linear_regression_slope(my_series)
print(f"The slope of the series is: {slope}")
Exceptions
The library uses standard Python exceptions to report errors. The most common are:
* ValueError
: Raised when a function receives an argument of the correct type but an inappropriate value (e.g., a time-series that is too short for a given calculation).
* TypeError
: Raised when a function receives an argument of the wrong type (e.g., a list where a NumPy array is expected).
Functions Reference
trend_strength(series, period=1, seasonal=7, robust=False)
strength = ete_ts.trend_strength(my_series)
trend_changes(series, model="l2", min_size=2, jump=5, params=None, custom_cost=None)
changes = ete_ts.trend_changes(my_series)
linear_regression_slope(series)
slope = ete_ts.linear_regression_slope(my_series)
linear_regression_r2(series)
r2_score = ete_ts.linear_regression_r2(my_series)
forecastability(series, sf, method="welch", nperseg=None, normalize=False)
entropy = ete_ts.forecastability(my_series, sf=1.0)
fluctuation(series)
fluc = ete_ts.fluctuation(my_series)
window_fluctuation(series)
win_fluc = ete_ts.window_fluctuation(my_series)
seasonal_strength(series, period=1, seasonal=7, robust=False)
season_str = ete_ts.seasonal_strength(my_series)
ac_relevance(series)
relevance = ete_ts.ac_relevance(my_series)
st_variation(series)
variation = ete_ts.st_variation(my_series)
diff_series(series)
diff_acf = ete_ts.diff_series(my_series)
complexity(series)
comp = ete_ts.complexity(my_series)
rec_concentration(series)
concentration = ete_ts.rec_concentration(my_series)
centroid(series, fs=1)
spec_centroid = ete_ts.centroid(my_series, fs=1)
info()
all_metrics(series, fs=1)
outputs = ete_ts.all_metrics(my_series, fs=1)