machine learning - Visualizing the Model using export_graphviz from .pkl file -
i have exported model .pkl
file. trying import via joblib
imports in form sklearn.model_selection._search.gridsearchcv
.
however not able use sklearn.tree
import export_graphvizexport_graphviz
expects tree_
first parameter.
is there way this? here code:
export_graphviz(model,out_file="out.dot") traceback (most recent call last): file "", line 1, in file "/home/anaconda3/lib/python3.6/site-packages/sklearn/tree/export.py", line 433, in export_graphviz recurse(decision_tree.tree_, 0, criterion=decision_tree.criterion) attributeerror: 'gridsearchcv' object has no attribute 'tree_'
how did define gridsearchcv , train it?
most underlying tree in gridsearchcv can accessed by:-
decision_tree.best_estimator_.tree_
if decision_tree
gridsearchcv object
Comments
Post a Comment