TypeError when extracting features from timeseries data using Python tsfresh module

Viewed 194

I am trying to extract features from timeseries data using the tsfresh library in Python.

I have formatted the data to match what is done in this tutorial:

https://www.ksk-anl.com/blog/time-series-as-supervised-learning-tsfresh-for-classification/

There are 2 differences I can see with what I am doing and the tutorial. First is I am using just one time-series feature. I don't see how this could be the issue. The second is I have a range of labels (which I have converted to integers) rather than boolean labels in the example.

Code I am running which creates the error:

extracted_features = tsfresh.extract_relevant_features(ts_df, labels, column_id='Parcel_ID', column_sort='Time')

Output from .head() to show the data and it's format:

ts_df.head()

   Row Number  Parcel_ID  Time       Data
0           0   55820196     0   0.289922
1           1   55820196     1   0.057604
2           2   55820196     2   0.296588
3           3   55820196     3  0.0853291
4           4   55820196     4   0.347548

labels.head()

55820196     5
55820215    11
55820213    11
55820208     9
55820206     9
dtype: int64

The error which is given is:

Feature Extraction:   0%|          | 0/20 [00:00<?, ?it/s]Traceback (most recent call last):

  File "<ipython-input-100-7de3baf05280>", line 13, in <module>
    extracted_features = tsfresh.extract_relevant_features(ts_df, labels, column_id='Parcel_ID', column_sort='Time')

  File "C:\Users\a08056114\.conda\envs\py36\lib\site-packages\tsfresh\convenience\relevant_extraction.py", line 164, in extract_relevant_features
    impute_function=impute)

  File "C:\Users\a08056114\.conda\envs\py36\lib\site-packages\tsfresh\feature_extraction\extraction.py", line 159, in extract_features
    distributor=distributor)

  File "C:\Users\a08056114\.conda\envs\py36\lib\site-packages\tsfresh\feature_extraction\extraction.py", line 296, in _do_extraction
    function_kwargs=kwargs)

  File "C:\Users\a08056114\.conda\envs\py36\lib\site-packages\tsfresh\utilities\distribution.py", line 149, in map_reduce
    result = list(itertools.chain.from_iterable(result))

  File "C:\Users\a08056114\.conda\envs\py36\lib\site-packages\tqdm\std.py", line 1081, in __iter__
    for obj in iterable:

  File "C:\Users\a08056114\.conda\envs\py36\lib\multiprocessing\pool.py", line 735, in next
    raise value

TypeError: 1st argument must be a real sequence 2

I'm struggling to diagnose the error. Any help would be greatly appreciated.

0 Answers
Related