TSFRESH: Get N most relevant features

1.4k Views Asked by At

Is there any way to get the N most relevant features in TSFRESH? Currently, the method extract_relevant_features has a parameter fdr_level, but for a big amount of time series (>1000), the function with a very low fdr_level parameter (< 0.01) returns more than 400 features. I would like to return the 20 or 40 most relevant features.

1

There are 1 best solutions below

0
On

You could use the function calculate_relevance_table (link to the docu) (which is called internally in the select_features method, which in turn is called in the extract_relevant_features method) to get the p-value for each of the features and then only use the TOP-N sorted by p-value. So the general flow would be:

  • extract all features with extract_features
  • call calculate_relevance_table
  • sort by p-value
  • get only the top N

You could even tell tsfresh the next time to only extract those features (to save a lot of computation time) following this.