我正在使用sklearn的GBDT,我想知道有什么方法可以获得最终训练的GBDT树信息?我的理解是,如果我设置最大500棵树和每棵树的最大深度10,这是一个上限,我想要获得实际使用的树的数量和每棵树的实际深度。
发布于 2019-03-07 04:56:11
您链接到的文档页面列出了以下属性:
estimators_ : ndarray of DecisionTreeRegressor,shape (n_estimators, loss_.K)
The collection of fitted sub-estimators. loss_.K is 1 for binary classification, otherwise n_classes.因此,您应该能够按照添加到模型中的顺序获取单个树。
附加注释:模型中使用的实际树数量将等于参数n_estimators,除非使用提前停止,否则它可能会更少,并存储在以下属性中:
n_estimators_ : int
The number of estimators as selected by early stopping (if n_iter_no_change is specified). Otherwise it is set to n_estimators深度是最大化的,除非没有足够的每叶采样数/分割和其他参数限制。
https://stackoverflow.com/questions/55029954
复制相似问题