text_plain_output_1.png image_output_1.png
from sklearn.datasets import load_iris

from sklearn.tree import DecisionTreeClassifier

import pandas as pd

iris = load_iris()
x = pd.DataFrame(data=iris.data, columns=iris.feature_names)
y = iris.target

from sklearn.tree import DecisionTreeClassifier
model = DecisionTreeClassifier(random_state=0)

model.fit(x_train, y_train)

y_pred = model.predict(x_test)

pred = pd.DataFrame({'Actual': y_test, 'Predicted': y_pred})
pred.to_csv('result.csv', index=False)

pred