Gradient Boosting学习一个看起来像这样的函数:
F(X) = W1*T1(X) + W2*T2(X) + ... + Wi*Ti(X)
其中Wi是权重而Ti是弱学习者(决策树)。我知道如何从scikit-learn中的拟合梯度增强模型中提取单个Ti(estimators_属性),但有没有办法提取Wi?
答案 0 :(得分:2)
访问第一棵树的终端区域的估计值::
tree = gbrt.estimators_[0, 0].tree_
leaf_mask = tree.children_left == TREE_LEAF # TREE_LEAF == -1
w_i = tree.value[leaf_mask, 0, 0]
[1] https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/ensemble/gradient_boosting.py#L197