We can use the below code snippet to perform prediction on Iris dataset.
from sklearn.datasets import load_iris
from sklearn import tree
iris = load_iris()
print(list(iris.target_names))
classifier = tree.DecisionTreeClassifier()
classifier = classifier.fit(iris.data, iris.target)
print(classifier.predict([[5.1,3.5,1.4,1.5]]))
Refer:
No comments:
Post a Comment