【機器學習筆記】xgboost中的min_child_weight參數理解。

對於xgboost,min_child_weight是一個非常重要的參數,官方文檔描述如下:

minimum sum of instance weight (hessian) needed in a child. If the tree partition step results in a leaf node with the sum of instance weight less than min_child_weight, then the building process will give up further partitioning. In linear regression mode, this simply corresponds to minimum number of instances needed to be in each node. The larger, the more conservative the algorithm will be.

直譯即:決定最小葉子節點樣本權重和。如果在一次分裂中,葉子節點上所有樣本的權重和小于min_child_weight則停止分裂,能夠有效的防止過擬合,防止學到特殊樣本。

解釋什么是樣本的權重和:
對於回歸問題,在一個節點上的損失為:
这里写图片描述
這個表達式的相對於 y i h a t 的二階導數為1。所以,對於這個節點上所有點的二階導數的加和,即所有樣本格數的和,即樣本權重和。在這裏,min_child_weight代表的意思是,儅一個節點下的樣本數小於給定的閾值時,則停止分裂!
對於二分類的邏輯回歸(a binary logistic regression),在節點上每一個點的海森矩陣(hessian)的表達式是:
这里写图片描述
其中σ代表sigmod函數。所以對於所有衹有一個樣本的節點node,則,所有的 y i hat有可能是一個非常大的正數,則所有的这里写图片描述 都將接近1,則整個海森表達式接近於0,則在每個節點上的樣本權重都會接近於0,因此,此時min_child_weight代表一旦达到某个节点的纯度并停止尝试分裂,并且您的模型可以适合它。
海森矩陣是一個明智的選擇,能夠起到正則化并且限制樹的深度防止過擬合的作用。对于回归,很容易看出如果你总是用一个观察值分解到节点,你可能会过度拟合。 同样,对于分类,如果你坚持分裂直到每个节点都是纯粹的,那麽也會導致過擬合的狀態。

參考:
1.https://stats.stackexchange.com/questions/317073/explanation-of-min-child-weight-in-xgboost-algorithm#
2.https://stats.stackexchange.com/questions/268276/what-does-min-child-weight-option-mean-in-xgboost-package-in-r-how-to-decide

猜你喜欢

转载自blog.csdn.net/m0_37477175/article/details/79991198
今日推荐