tsfresh.examples package

Submodules

tsfresh.examples.driftbif_simulation module

tsfresh.examples.driftbif_simulation.load_driftbif(n, length, m=2, classification=True, kappa_3=0.3, seed=False)[source]

Simulates n time-series with length time steps each for the m-dimensional velocity of a dissipative soliton

classification=True: target 0 means tau<=1/0.3, Dissipative Soliton with Brownian motion (purely noise driven) target 1 means tau> 1/0.3, Dissipative Soliton with Active Brownian motion (intrinsiv velocity with overlaid noise)

classification=False: target is bifurcation parameter tau

Parameters:
  • n (int) – number of samples
  • length (int) – length of the time series
  • m (int) – number of spatial dimensions (default m=2) the dissipative soliton is propagating in
  • classification (bool) – distinguish between classification (default True) and regression target
  • kappa_3 (float) – inverse bifurcation parameter (default 0.3)
  • seed (float) – random seed (default False)
Returns:

X, y. Time series container and target vector

Rtype X:

pandas.DataFrame

Rtype y:

pandas.DataFrame

tsfresh.examples.driftbif_simulation.sample_tau(n=10, kappa_3=0.3, ratio=0.5, rel_increase=0.15)[source]

Return list of control parameters

Parameters:
  • n (int) – number of samples
  • kappa_3 (float) – inverse bifurcation point
  • ratio (float) – ratio (default 0.5) of samples before and beyond drift-bifurcation
  • rel_increase (float) – relative increase from bifurcation point
Returns:

tau. List of sampled bifurcation parameter

Rtype tau:

list

class tsfresh.examples.driftbif_simulation.velocity(tau=3.8, kappa_3=0.3, Q=1950.0, R=0.0003, delta_t=0.05, seed=None)[source]

Bases: object

Simulates the velocity of a dissipative soliton (kind of self organized particle) [6]. The equilibrium velocity without noise R=0 for $ au>1.0/kappa_3$ is $kappa_3 sqrt{(tau - 1.0/kappa_3)/Q}. Before the drift-bifurcation $ au le 1.0/kappa_3$ the velocity is zero.

References

[6]Andreas Kempa-Liehr (2013, p. 159-170) Dynamics of Dissipative Soliton Dissipative Solitons in Reaction Diffusion Systems. Springer: Berlin
>>> ds = velocity(tau=3.5) # Dissipative soliton with equilibrium velocity 1.5e-3
>>> print(ds.label) # Discriminating before or beyond Drift-Bifurcation
1

# Equilibrium velocity >>> print(ds.deterministic) 0.0015191090506254991

# Simulated velocity as a time series with 20000 time steps being disturbed by Gaussian white noise >>> v = ds.simulate(20000)

simulate(N, v0=array([0., 0.]))[source]
Parameters:
  • N (int) – number of time steps
  • v0 (ndarray) – initial velocity vector
Returns:

time series of velocity vectors with shape (N, v0.shape[0])

Return type:

ndarray

tsfresh.examples.har_dataset module

This module implements functions to download and load the Human Activity Recognition dataset [4]. A description of the data set can be found in [5].

References

[4]https://archive.ics.uci.edu/ml/datasets/Human+Activity+Recognition+Using+Smartphones
[5]Davide Anguita, Alessandro Ghio, Luca Oneto, Xavier Parra and Jorge L. Reyes-Ortiz. (2013) A Public Domain Dataset for Human Activity Recognition Using Smartphones. 21th European Symposium on Artificial Neural Networks, Computational Intelligence and Machine Learning, ESANN 2013. Bruges, Belgium 24-26 April 2013.
tsfresh.examples.har_dataset.download_har_dataset(folder_name='/home/docs/checkouts/readthedocs.org/user_builds/tsfresh/envs/latest/lib/python3.7/site-packages/tsfresh/examples/data/UCI HAR Dataset')[source]

Download human activity recognition dataset from UCI ML Repository and store it at /tsfresh/notebooks/data.

Examples

>>> from tsfresh.examples import har_dataset
>>> har_dataset.download_har_dataset()
tsfresh.examples.har_dataset.load_har_classes(folder_name='/home/docs/checkouts/readthedocs.org/user_builds/tsfresh/envs/latest/lib/python3.7/site-packages/tsfresh/examples/data/UCI HAR Dataset')[source]
tsfresh.examples.har_dataset.load_har_dataset(folder_name='/home/docs/checkouts/readthedocs.org/user_builds/tsfresh/envs/latest/lib/python3.7/site-packages/tsfresh/examples/data/UCI HAR Dataset')[source]

tsfresh.examples.robot_execution_failures module

This module implements functions to download the Robot Execution Failures LP1 Data Set [1], [2], [3] and load it as as DataFrame.

Important: You need to download the data set yourself, either manually or via the function download_robot_execution_failures()

References

[1]https://archive.ics.uci.edu/ml/datasets/Robot+Execution+Failures
[2]Lichman, M. (2013). UCI Machine Learning Repository [https://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.
[3]Camarinha-Matos, L.M., L. Seabra Lopes, and J. Barata (1996). Integration and Learning in Supervision of Flexible Assembly Systems. “IEEE Transactions on Robotics and Automation”, 12 (2), 202-219
tsfresh.examples.robot_execution_failures.download_robot_execution_failures(file_name='/home/docs/checkouts/readthedocs.org/user_builds/tsfresh/envs/latest/lib/python3.7/site-packages/tsfresh/examples/data/robotfailure-mld/lp1.data')[source]

Download the Robot Execution Failures LP1 Data Set[#1] from the UCI Machine Learning Repository [#2] and store it locally.

Returns:

Examples

>>> from tsfresh.examples import download_robot_execution_failures
>>> download_robot_execution_failures()
tsfresh.examples.robot_execution_failures.load_robot_execution_failures(multiclass=False, file_name='/home/docs/checkouts/readthedocs.org/user_builds/tsfresh/envs/latest/lib/python3.7/site-packages/tsfresh/examples/data/robotfailure-mld/lp1.data')[source]

Load the Robot Execution Failures LP1 Data Set[1]. The Time series are passed as a flat DataFrame.

Examples

>>> from tsfresh.examples import load_robot_execution_failures
>>> df, y = load_robot_execution_failures()
>>> print(df.shape)
(1320, 8)
Parameters:multiclass (bool) – If True, return all target labels. The default returns only “normal” vs all other labels.
Returns:time series data as pandas.DataFrame and target vector as pandas.Series
Return type:tuple

Module contents

Module with exemplary data sets to play around with.

See for eample the Quick Start section on how to use them.