text_plain_output_1.png
from sklearn.metrics import accuracy_score, confusion_matrix, classification_report

from sklearn.metrics import accuracy_score, confusion_matrix, classification_report

from sklearn.model_selection import cross_val_score

from sklearn.model_selection import cross_val_score

from sklearn.model_selection import train_test_split

from sklearn.model_selection import train_test_split, cross_val_score

from sklearn.tree import DecisionTreeClassifier

from sklearn.tree import DecisionTreeClassifier, plot_tree, export_text

import pandas as pd

df = pd.read_csv('/kaggle/input/iris-flower-dataset/IRIS.csv')

df.columns

y = df['species']
X = df.drop(['species'], axis=1)
from sklearn.model_selection import train_test_split
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)

from sklearn.tree import DecisionTreeClassifier
clf = DecisionTreeClassifier()
clf.fit(X_train, y_train)

from sklearn.metrics import accuracy_score, confusion_matrix, classification_report
prediction = clf.predict(X_test)
accuracy_score(y_test, prediction)

from sklearn.model_selection import cross_val_score
scores = cross_val_score(clf, X, y, scoring='accuracy', cv=10)
scores.mean()