对叶的理解有点困难。我知道概率可以用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()
目前没有回答
相关问题 更多 >
编程相关推荐