1
$\begingroup$

How can I select the top n features of time series dataset using tsfresh? Can I decide the number of top features I would like to extract?

$\endgroup$

1 Answer 1

1
$\begingroup$

You can use tsfresh relevance table to solve this issue. After you extract your features with tsfresh:

from tsfresh.examples import load_robot_execution_failures
from tsfresh import extract_features, select_features
from tsfresh.feature_selection.relevance import calculate_relevance_table

y = pd.Series(data = extracted_features['class'], index=extracted_features.index)

relevance_table = calculate_relevance_table(features2, y)
relevance_table = relevance_table[relevance_table.relevant]
relevance_table.sort_values("p_value", inplace=True)

best_features = relevance_table.copy()

best_features.sort_values(by=['p_value'])

best_features

From now on, the only thing you need to do to choose the top n features. Just select fist n rows with the help of pandas.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.