開始使用免費開始

選出理想的資料集

現在要把 ufo 資料集中一些不必要的特徵移除。由於 country 欄已編碼為 country_enc,你可以保留它,並移除與地點相關的其他欄位:citycountrylatlongstate

你已經建立了 monthyear 欄,所以不再需要 daterecorded 欄。你也把 seconds 標準化為 seconds_log,因此可以移除 secondsminutes

你已將 desc 向量化,因此可以刪除。目前先保留 type

另外也可以移除 length_of_time 欄位,因為在擷取出 minutes 之後已經不需要了。

本練習屬於課程

Python 的 Machine Learning 前處理

檢視課程

練習說明

  • 建立要刪除的所有欄位清單 to_drop
  • ufo 中移除這些欄位。
  • 使用你先前建立的 words_to_filter() 函式;依序傳入 vocabvec.vocabulary_desc_tfidf,最後一個參數保留前 4 個字。

動手互動練習

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

# Make a list of features to drop
to_drop = [____]

# Drop those features
ufo_dropped = ufo.____

# Let's also filter some words out of the text vector we created
filtered_words = ____(____, ____, ____, ____)
編輯並執行程式碼