BaşlayınÜcretsiz Başlayın

Pipeline for song genre prediction: I

Now it's time to build a pipeline. It will contain steps to impute missing values using the mean for each feature and build a KNN model for the classification of song genre.

The modified music_df dataset that you created in the previous exercise has been preloaded for you, along with KNeighborsClassifier and train_test_split.

Bu egzersiz

Supervised Learning with scikit-learn

kursunun bir parçasıdır
Kursu Görüntüle

Egzersiz talimatları

  • Import SimpleImputer and Pipeline.
  • Instantiate an imputer.
  • Instantiate a KNN classifier with three neighbors.
  • Create steps, a list of tuples containing the imputer variable you created, called "imputer", followed by the knn model you created, called "knn".

Uygulamalı interaktif egzersiz

Bu örnek kodu tamamlayarak bu egzersizi bitirin.

# Import modules
____
____

# Instantiate an imputer
imputer = ____()

# Instantiate a knn model
knn = ____

# Build steps for the pipeline
steps = [("____", ____), 
         ("____", ____)]
Kodu Düzenle ve Çalıştır