CommencerCommencer gratuitement

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.

Cet exercice fait partie du cours

Machine Learning for Time Series Data in Python

Afficher le cours

Instructions

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

Exercice interactif pratique

Essayez cet exercice en complétant cet exemple de code.

# 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))
Modifier et exécuter le code