MulaiMulai sekarang secara gratis

Calculating features from the envelope

Now that you've removed some of the noisier fluctuations in the audio, let's see if this improves your ability to classify.

audio_rectified_smooth from the previous exercise is available in your workspace.

Latihan ini adalah bagian dari kursus

Machine Learning for Time Series Data in Python

Lihat Kursus

Petunjuk latihan

  • Calculate the mean, standard deviation, and maximum value for each heartbeat sound.
  • Column stack these stats in the same order.
  • Use cross-validation to fit a model on each CV iteration.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# 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))
Edit dan Jalankan Kode