How to make tsfresh.extract_features work?

tsfresh is a library used for time series analyzing. I am trying to work through the Quick Start Guide in their docs but the code provided seems to not work.

import matplotlib.pyplot as plt
from tsfresh import extract_features, select_features
from tsfresh.utilities.dataframe_functions import impute
from tsfresh.examples.robot_execution_failures import download_robot_execution_failures, \
    load_robot_execution_failures

download_robot_execution_failures()
timeseries, y = load_robot_execution_failures()

extracted_features = extract_features(timeseries,
                                      column_id="id",
                                      column_sort="time")

Output:

Feature Extraction:   0%|          | 0/20 [00:00<?, ?it/s]

This is where tsfresh gets stuck. It seems to do something in the background but does not pass 0%. What am I doing wrong?

Upvotes: 2

Views: 1579

Answers (1)

e5k
e5k

Reputation: 324

There have been a few issues mentioning this problem (see #400, #402, #456, #490). For me, the behaviour of extract_feature varies amongst the example notebooks, with some giving me the same error as the one you mentioned. Following #490, turning off multiprocessing with n_jobs=0 fixed most of my issues, e.g.:

extracted_features = extract_features(timeseries,
                                      column_id="id",
                                      column_sort="time",
                                      n_jobs=0)

Note that:

  • Although issue #490 mentions Windows, this was the case for me on MacOS 10.15
  • Still the progress bar sometime remains stuck at 0% despite ongoing processing

Upvotes: 2

Related Questions