在分類器中結合多種特徵
在本課中,你已經從音訊資料中打造了許多特徵——有些描述音訊隨時間的變化,有些則包含頻譜內容的資訊。
機器學習的厲害之處,是能同時處理這些特徵。如果每個特徵都帶來不同的資訊,就能提升分類器分辨音訊類型的能力。請注意,這通常需要更進階的技巧,例如正規化;我們會在下一章介紹。
作為本章最後一個練習,我們已經載入多個你先前計算過的特徵。請把它們全部結合成一個可輸入分類器的陣列,並觀察成效。
本練習屬於課程
Python 的時間序列資料機器學習
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Loop through each spectrogram
bandwidths = []
centroids = []
for spec in spectrograms:
# Calculate the mean spectral bandwidth
this_mean_bandwidth = np.____(lr.feature.____(S=spec))
# Calculate the mean spectral centroid
this_mean_centroid = np.____(lr.feature.____(S=spec))
# Collect the values
bandwidths.append(this_mean_bandwidth)
centroids.append(this_mean_centroid)