刚刚使用SKLearn学习机器学习进行数据分析,分享一些概念和想法,希望可以大家一起讨论,如果理解或者表达有不准确的地方,请多多指点,不吝赐教,非常感谢~~
涉及决策树其他参数:
请转至《DecisionTreeClassifier与红酒数据集(criterion及创建一个树)》:https://blog.csdn.net/weixin_42969619/article/details/98884082
以及《sklearn的DecisionTreeClassifier与红酒数据集(参数random_state & splitter )》:
https://blog.csdn.net/weixin_42969619/article/details/99301017
超参数的学习曲线,是一条以超参数的取值为横坐标,模型的度量指标为纵坐标的曲
线(即score),它是用来衡量不同超参数取值下模型的表现的线。
import matplotlib.pyplot as plt
test = []
for i in range(10):
clf = tree.DecisionTreeClassifier(max_depth=i+1
,criterion="entropy"
,random_state=30
,splitter="random"
)
clf = clf.fit(Xtrain, Ytrain)
score = clf.score(Xtest, Ytest)
test.append(score)
plt.plot(range(1,11),test,color="red",label="max_depth")
plt.legend()
plt.show()
可以看出,在max_depth参数取值为3时, score分数最高
- 学习曲线可以确定某一个参数的最优值,之后会介绍如何一次性调整多个参数
----- 待续