0% found this document useful (0 votes)
38 views1 page

Decision Tree

The document outlines a Python script that utilizes the scikit-learn library to implement a Decision Tree Classifier on the Iris dataset. It includes data loading, splitting into training and testing sets, model training, and accuracy evaluation. The final output is the accuracy score of the model on the test data.

Uploaded by

rajatgodara759
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views1 page

Decision Tree

The document outlines a Python script that utilizes the scikit-learn library to implement a Decision Tree Classifier on the Iris dataset. It includes data loading, splitting into training and testing sets, model training, and accuracy evaluation. The final output is the accuracy score of the model on the test data.

Uploaded by

rajatgodara759
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

from sklearn.

linear_model import LinearRegression


from sklearn.linear_model import LogisticRegression
import numpy as np
import pandas as pd
from [Link] import load_iris
import [Link] as plt
from sklearn.model_selection import train_test_split
from [Link] import PCA
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as
LDA
from [Link] import StandardScaler
from [Link] import load_iris
import seaborn as sns
from [Link] import DecisionTreeClassifier
from [Link] import accuracy_score
iris = load_iris()
X = [Link]
y=[Link]
X_train, X_test, y_train, y_test = train_test_split(X, y,
test_size=0.2, random_state=42)
clf=DecisionTreeClassifier()
[Link](X_train,y_train)
y_pred=[Link](X_test)
accuracy=accuracy_score(y_test,y_pred)
print(accuracy)

You might also like