Aan de slagGa gratis aan de slag

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.

Deze oefening maakt deel uit van de cursus

Machine Learning for Time Series Data in Python

Cursus bekijken

Oefeninstructies

  • 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.

Praktische interactieve oefening

Probeer deze oefening eens door deze voorbeeldcode in te vullen.

# 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))
Code bewerken en uitvoeren