Desicion Tress simple code in Python
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.datasets import load_iris
from sklearn import tree
clf = tree.DecisionTreeClassifier (random_state=0)
iris = load_iris()
clf = clf.fit(iris.data, iris.target)
plt.figure (figsize=(15,10))
tree.plot_tree (clf,filled=True,precision=3)
plt.show()
Output:-
Note : Run the above program in this link only ,i am not sure if it works in other compliershttps://hub.mybinder.turing.ac.uk/user/ipython-ipython-in-depth-eyy3zsds/notebooks/binder/Index.ipynb
No comments