XG叶片得分

2024-04-24 19:26:24 发布

您现在位置:Python中文网/ 问答频道 /正文

对叶的理解有点困难。我知道概率可以用sigmoid函数来计算,但是leaf分数是如何计算出来的,它们又是如何解释的呢?在

谁能帮忙解释一下吗?我读了文章和文件。下面是一个带有叶分数的printet树以及生成它的代码。在

from xgboost import XGBClassifier
from xgboost import plot_tree
import matplotlib.pyplot as plt
from sklearn.datasets import make_classification

X, y = make_classification(n_samples=2000, n_features=4, n_informative=2, n_classes=2, n_clusters_per_class=1, random_state=42, weights=[0.1, 0.9])
model = XGBClassifier(objective="binary:logistic")
model.fit(X, y)

plot_tree(model, num_trees=0)
plt.show()

enter image description here


Tags: 函数fromimporttreemakemodelplotplt