小數的正規化
在先前的範例中,你已經看過整數的正規化。這個練習要來看分數(小數)資料的處理——邦加拉(Bangalla)這個國家的利率多年來的變動。為了方便你使用,matplotlib.pyplot 已匯入為 plt。
本練習屬於課程
Python 中的叢集分析
練習說明
- 將包含利率變動的清單
rate_cuts進行縮放。 - 將原始資料與縮放後的資料繪製在同一圖中做比較。
動手互動練習
試著完成這個範例程式碼,體驗一下這個練習。
# Prepare data
rate_cuts = [0.0025, 0.001, -0.0005, -0.001, -0.0005, 0.0025, -0.001, -0.0015, -0.001, 0.0005]
# Use the whiten() function to standardize the data
scaled_data = ____(____)
# Plot original data
plt.____(____, label='original')
# Plot scaled data
plt.____(____, label='scaled')
plt.legend()
plt.show()