Feature Encoding Comparison

Feature encoding comparison

不同的特徵編碼方法比較:

  1. One-hot encoding
    • 優點:不假設類別順序,適用於名義變數
    • 缺點:可能產生大量新特徵
  2. Ordinal encoding
    • 優點:不增加特徵數量,適用於順序變數
    • 缺點:可能引入錯誤的順序關係
  3. Mean encoding
    • 優點:可捕捉類別與目標的關係,適用於高基數變數
    • 缺點:容易過擬合,需要謹慎處理時間序列數據

選擇考慮因素:

  • 變數的性質(名義、順序、高基數等)
  • 數據集大小和模型複雜度
  • 時間序列數據的特殊要求

最佳實踐:

  • 在訓練集上fit,在測試集上transform
  • 對時間序列數據使用expanding window方法
  • 考慮使用交叉驗證來評估不同編碼方法的效果

This line appears after every note.

Notes mentioning this note


Here are all the notes in this garden, along with their links, visualized as a graph.

數位花園首頁 - 特徵工程筆記Feature Encoding ComparisonMean EncodingOne Hot EncodingOrdinal Encoding