Is Lab Aman Agarwal PDF
Is Lab Aman Agarwal PDF
QUESTION: Write a program to demonstrate the working of decision tree based ID3 algorithm. Use an appropriate
data set for building the decision tree and apply this knowledge to classify a new sample.
SOURCE CODE:
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
dataset = pd.read_csv('Social_Network_Ads.csv')
X = dataset.iloc[:, :-1].values
y = dataset.iloc[:, -1].values
"""## Splitting the dataset into the Training set and Test set"""
print(X_train)
print(y_train)
print(X_test)
print(y_test)
print(X_train)
print(X_test)
print(classifier.predict(sc.transform([[30,87000]])))
y_pred = classifier.predict(X_test)
print(np.concatenate((y_pred.reshape(len(y_pred),1), y_test.reshape(len
(y_test),1)),1))
SCREENSHOT:
GRAPH: