-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
Broken fill color generation for tree.export_graphviz #6352
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello @tracer0tong , 1. elif tree.n_classes[0] == 1:
# Find max and min values in leaf nodes for regression
colors['bounds'] = (np.min(tree.value),
np.max(tree.value)) indicate that 2. If there's only one kind of label provided by data, it will cause zero division. |
You are right, because there is undefined state. We couldn't decide is it |
Finally, I've decided to make fix for this issue. Hope this fix will be accepted. |
MAINT: Simplify n_features_to_select in RFECV Make dump_svmlight_file support sparse y Fix for issue scikit-learn#6352 Fixed codestyle Merge PR scikit-learn#6037: copy_X in KernelPCA Ensuring consistent transforms for KernelPCA Taking @vene's changes into account, thanks! Taking @jakevdp's comment into account Added more verbose documentation to kernel_pca.py Specifying that X_fit_ will not be None. @jakevdp KernelPCA: Fixing more formatting of docstring Addressed @vene's documentation comments Addressing that dual_coef_ might not be present in model in docs. @vene Make assign_rows_csr support Cython fused types Use fused type in inplace normalize Test normalize function in data.py DOC: mark weights as optional [DOC] Fix broken links
Example:
from sklearn import tree
clf = tree.DecisionTreeClassifier()
clf.fit([[0]],[1])
tree.export_graphviz(clf, filled=True)
We'll get error in line 160 of sklearn/tree/export.py:
alpha = int(np.round(255 * ((value - colors['bounds'][0]) / (colors['bounds'][1] - colors['bounds'][0])), 0))
Basically we will get zero division, because
colors['bounds'][0]
equalscolors['bounds'][1]
.The text was updated successfully, but these errors were encountered: