心电图心跳信号分类 特征工程
数据竞赛 Datawhale 2021-03-22 13:10:28 2021-03-22 15:52:52 498 次浏览概述
原先的数据是按照时间顺序排列的,之前的基准模型中我们并没有利用到这一关键信息。
这里主要的思路是使用 Tsfresh 对时序数据进行处理,得到非时序的特征,之后再送入模型进行训练。
处理的大致流程
- 先将数据中的信号值分开成单独的列,之后叠加在一起。
time heartbeat_signals 0 0 0.991571 0 1 1.000000 0 2 0.631816 0 3 0.136230 0 4 0.041420 ... ... ... 19999 200 0.000000 19999 201 0.000000 19999 202 0.000000 19999 203 0.000000 19999 204 0.000000 4100000 rows × 2 columns
- 之后将 index 列复制为 id 列。
time heartbeat_signals id 0 0 0.991571 0 0 1 1.000000 0 0 2 0.631816 0 0 3 0.136230 0 0 4 0.041420 0 ... ... ... ... 19999 200 0.000000 19999 19999 201 0.000000 19999 19999 202 0.000000 19999 19999 203 0.000000 19999 19999 204 0.000000 19999 4100000 rows × 3 columns
- 进行特征提取:
train_features = extract_features(data_train, column_id='id', column_sort='time')
- 删除 NaN 值:
impute(train_features)
- 选择与 label 相关特征:
- 训练集:
train_features_filtered = select_features(train_features, data_train_label)
- 测试集:
testA_features_filtered = testA_features[train_features_filtered.columns]
- 训练集:
- 将 label 列加回训练集:
train_features_filtered = train_features_filtered.join(data_train_label)
效果
8 折交叉验证,学习率为 0.05,真实分数为 511.2646,同等情况下使用原始特征的分数为 497.445。
反而更差了,把提取后的特征与原始特征结合起来,一起训练,分数为 461.5613。
算是有较大的提升,但是,排行榜上已经有大量的 200 多的了。。。
Links: heartbeat-classification-3