概述
隨機森林結合了許多隨機化決策樹,通常能降低估計器的變異數,但其準確性與適用性仍需針對特定任務進行評估。
深入探討
A decision tree uses feature-based tests to route an input toward a leaf prediction. Classification splits commonly seek reductions in Gini impurity or entropy, while regression can use squared-error criteria. A readable path explains the fitted rule followed by an example; it does not establish that a feature has a causal effect. Deep unconstrained trees can fit training-specific details and generalize poorly. A random forest combines many trees with randomized training choices. In a conventional bootstrap forest, each tree receives a sample drawn with replacement from the training rows. Random feature subsets provide another source of variation at splits. The two mechanisms differ: changing sampled rows is not the same as changing the features considered for a split. Combining less-correlated tree predictions can reduce variance, but it does not cancel every mistake or guarantee better accuracy than all alternatives. Classification aggregation may use votes or average class probabilities depending on the implementation; regression commonly averages numeric predictions. Bootstrap sampling also leaves some training rows out of each tree. For a given row, trees that did not train on it can supply an out-of-bag prediction. Aggregated out-of-bag predictions provide an internal generalization estimate without treating those rows as unseen by the entire forest. Gradient boosting is a different ensemble approach that adds trees sequentially according to its training objective. XGBoost is a tree-boosting system, rather than another name for a random forest. Compare these methods using appropriate evaluation conditions and the actual dataset.
現實世界的實施
追蹤已擬合決策樹中單一範例所經過的特徵分割路徑。
在留出的表格資料範例上比較深度決策樹與隨機森林。
研究森林訓練中的自助採樣(bootstrap samples)與特徵子集。
使用袋外(out-of-bag)預測作為自助採樣訓練下的內部估計。
決策樹與隨機森林的未來
決策樹整合模型對於結構化資料任務仍然是實用的候選模型。在相同的資料分割與資源限制下,比較森林與提升(boosting)配置與其他模型。評估應涵蓋預期的預測任務,並說明超參數是如何選擇的。清晰的決策路徑或排序後的特徵重要性可以輔助檢查,但這並不自動等同於因果解釋。報告應陳述測量到的效能與不確定性,而非假設每一座森林都能改善每一棵決策樹,或普遍優於類神經網路。
付諸實踐
為什麼這很重要
- 更明確的決策. 它可以幫助您將清晰的技術聲明與行銷語言分開。
- 成本與預算. 在花費金錢或時間之前,您可以提出更好的實施問題。
- 團隊與工作流程. 具有共同理解的團隊可以做出更好的產品、政策和學習決策。
留意
- 不同的團隊可能會以不同的方式使用相同術語,因此請儘早定義範圍。
- 基準測試可能看起來很強大,但實際效能卻參差不齊。
- 忽視數據品質和評估計劃通常會產生脆弱的結果。
後續步驟
- 從您需要的結果的簡單語言定義開始。
- 在測試之前選擇一種成功指標和一種失敗條件。
- 使用代表性資料運行小型試點,而不是完善的演示集。
- 記錄決策樹和隨機森林在哪些方面有幫助以及在哪些方面更簡單的方法更好。
不斷探索
常見問題
什麼是決策樹與隨機森林?
決策樹透過基於特徵的分割將輸入引導至葉節點的預測結果。隨機森林結合了許多隨機化決策樹,通常能降低估計器的變異數,但其準確性與適用性仍需針對特定任務進行評估。
決策樹如何做出預測?
決策樹透過有關其特徵的分支問題路由輸入,直到到達給出預測的葉子。
單一深度決策樹的主要弱點是什麼?
深樹可能與訓練資料擬合得太緊密,從而捕獲雜訊並且無法很好地推廣到新範例。
隨機森林如何結合其組成決策樹的預測結果?
聚合方式取決於實作與輸出任務;結合決策樹可以降低變異數,但無法消除所有誤差。
袋裝法(bagging)在建構傳統自助採樣訓練集時使用什麼採樣操作?
自助採樣以取後放回的方式抽取樣本列,因此列可能會重複,而其他列可能會被遺漏。
分類樹通常使用什麼指標來選擇分割?
分類樹選擇最能減少基尼不純度或熵的分割,基尼不純度或熵是衡量節點上類別的混合程度的指標。