開始使用免費開始

找出需要標準化的特徵

在這個練習中,你要檢視 UFO 資料集各欄位的變異數,判斷哪些特徵需要標準化。先看看 secondsminutes 兩個欄位的變異數,你會發現 seconds 的變異數非常高。由於 secondsminutes 彼此相關(在之後進行模型特徵選擇時會處理這個問題),我們先對 seconds 欄位做對數正規化。

本練習屬於課程

Python 的 Machine Learning 前處理

檢視課程

練習說明

  • 計算 secondsminutes 欄位的變異數,並仔細查看結果。
  • seconds 欄位執行對數正規化,轉換成名為 seconds_log 的新欄位。
  • 列印 seconds_log 欄位的變異數。

動手互動練習

試著完成這個範例程式碼,體驗一下這個練習。

# Check the variance of the seconds and minutes columns
print(____)

# Log normalize the seconds column
ufo["seconds_log"] = ____

# Print out the variance of just the seconds_log column
print(____)
編輯並執行程式碼