Alguém pode me ajudar? Ao tentar rodar o código para gerar a visualização da arvore, apresenta o seguinte erro:
Código:
from sklearn.tree import export_graphviz
import graphviz
modelo.fit(x_azar, y_azar)
features = x_azar.columns
dot_data = export_graphviz(modelo, out_file=None, filled=True, rounded=True, class_names=["não", "sim"], feature_names = features)
graph = graphviz.Source(dot_data)
graph
Erro:
--------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-11-2975df26fe79> in <module>()
4 modelo.fit(x_azar, y_azar)
5 features = x_azar.columns
----> 6 dot_data = export_graphviz(modelo, out_file=None, filled=True, rounded=True, class_names=["não", "sim"], feature_names = features)
7
8 graph = graphviz.Source(dot_data)
1 frames
/usr/local/lib/python3.7/dist-packages/sklearn/tree/_export.py in export(self, decision_tree)
460 self.recurse(decision_tree, 0, criterion="impurity")
461 else:
--> 462 self.recurse(decision_tree.tree_, 0, criterion=decision_tree.criterion)
463
464 self.tail()
AttributeError: 'SVC' object has no attribute 'tree_'