適合用於決策樹的資料
決策樹在您擁有表格資料集 (您可能會在試算表、CSV 檔案或資料庫資料表中呈現的資料) 時最有效。表格資料是最常見的資料格式之一,而決策樹應是建模的「首選」解決方案。
表 1. 表格式資料集的範例。
航段數 |
眼睛數量 |
體重 (磅) |
物種 (標籤) |
2 | 2 | 12 | 企鵝 |
8 | 6 | 0.1 | 蜘蛛 |
4 | 2 | 44 | 狗 |
⋯⋯ | ⋯⋯ | ⋯⋯ | ⋯⋯ |
與神經網路不同,決策樹會原生使用模型表格資料。開發決策樹時,您不必執行下列任務:
- 執行預先處理作業,例如特徵規格化或 one-hot 編碼。
- 執行推論 (例如,將缺少的值替換為
-1
)。
不過,決策樹不太適合直接使用非表格資料 (也稱為非結構化資料),例如圖片或文字。是的,確實有解決這個限制的因應措施,但神經網路通常可更妥善地處理非結構化資料。
決策樹可有效利用樣本,也就是說,決策樹非常適合用於訓練小型資料集,或是特徵數量 / 樣本數量比率較高的資料集 (可能大於 1)。雖然決策樹可有效運用樣本,但與所有機器學習模型一樣,決策樹的最佳成效是在大量資料可用時。
決策樹的推論速度通常比類似的神經網路快。舉例來說,中型決策樹在現代 CPU 上執行推論的時間只需幾微秒。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-02-25 (世界標準時間)。
[null,null,["上次更新時間:2025-02-25 (世界標準時間)。"],[[["Decision forests are highly effective for modeling tabular data, making them a primary choice for datasets commonly found in spreadsheets, CSV files, or databases."],["Unlike neural networks, decision forests directly handle tabular data without requiring preprocessing steps like feature normalization or imputation."],["While decision forests can be adapted for non-tabular data like images or text, neural networks are generally better suited for such data types."],["Decision forests are sample efficient, performing well even with small datasets or those with a high feature-to-example ratio, but still benefit from larger datasets."],["Decision forests offer faster inference speeds compared to neural networks, typically completing predictions within microseconds on modern CPUs."]]],[]]