[英]Selecting only a certain number of top features using tsfresh
How can I select top n features of time series using tsfresh?如何使用 tsfresh select 时间序列的前 n 个特征? Can I decide the number of top features I want to extract?
我可以决定要提取的主要特征的数量吗?
Based on the above comment from @Chaitra and this answer I give an answer.根据@Chaitra 的上述评论和这个答案,我给出了答案。
You can decide the number of top features by using the tsfresh
relevance table described in the documentation here .您可以使用此处文档中描述的
tsfresh
相关性表来决定顶级功能的数量。 You can then sort the table by the p-value and the the top n
features.然后,您可以按 p 值和前
n
特征对表进行排序。
Example code printing top 11 features:示例代码打印前 11 个功能:
from tsfresh import extract_features
from tsfresh.feature_selection.relevance import calculate_relevance_table
extracted_features = extract_features(
X,
column_id="id",
column_kind="kind",
column_value="value",
)
relevance_table = calculate_relevance_table(extracted_features, y)
relevance_table = relevance_table[relevance_table.relevant]
relevance_table.sort_values("p_value", inplace=True)
print(relevance_table.loc["feature"][:11])
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.