엔벌로프에서 특징 계산하기
오디오에서 더 잡음이 큰 변동을 제거했으니, 이제 분류 성능이 향상되는지 확인해 보죠.
이전 연습 문제에서 만든 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))