エンベロープから特徴量を計算する
オーディオのノイズの大きい変動を取り除いたので、分類性能が向上するか確認してみましょう。
前の演習で作成した audio_rectified_smooth はワークスペースに用意されています。
この演習はコースの一部です
Pythonで学ぶMachine Learningによる時系列データ解析
演習の手順
- 各心拍音について、平均・標準偏差・最大値を計算します。
- これらの統計量を同じ順序で列方向にスタックします。
- 交差検証を使い、各CVイテレーションでモデルを学習させます。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
# Calculate stats
means = np.____(audio_rectified_smooth, axis=0)
stds = ____(audio_rectified_smooth, axis=0)
maxs = ____(audio_rectified_smooth, axis=0)
# Create the X and y arrays
X = np.column_stack([____, ____, ____])
y = labels.reshape(-1, 1)
# Fit the model and score on testing data
from sklearn.model_selection import cross_val_score
percent_score = ____(model, ____, ____, cv=5)
print(np.mean(percent_score))