我的目标是可视化渐变增强分类器的结果。
from sklearn.ensemble import GradientBoostingClassifier
clf_gbc = GradientBoostingClassifier(random_state=42)
pipe = Pipeline(steps=[('SELECT', selector), ('GBC', clf_gbc)])
parameters_gbc = {'GBC__min_samples_split': [1, 5, 10, 15, 20, 25, 30],
'GBC__max_depth': [3,4,5,6,7,8],
'GBC__min_samples_leaf': [1, 5, 10, 15, 25, 30]}
grid = GridSearchCV(estimator=pipe, param_grid=parameters_gbc, cv=cv, scoring = 'f1')
grid.fit(features_train, labels_train)
clf=grid.best_estimator_
import pydotplus
dot_data = tree.export_graphviz(clf, out_file=None)
graph = pydotplus.graph_from_dot_data(dot_data)
graph.write_pdf("gbc.pdf")
我收到错误ImportError: No module named pydotplus
。我使用pip install pydotplus
安装了pydotplus。
对此有任何帮助或如何可视化梯度增强分类器的结果将不胜感激!