Professional Documents
Culture Documents
In [22]:
1 import pandas as pd
2 import numpy as np
3
4 df1 = pd.read_csv('/home/c0nqu3r0r/Desktop/_Second sem/Data Mining/Dataset/Te
5 df1.drop('Day', axis = 1, inplace = True)# for classification
6
7 df2 = pd.read_csv('/home/c0nqu3r0r/Desktop/_Second sem/Data Mining/Dataset/ar
In [23]:
1 df1.head()
Out[23]:
In [24]:
In [25]:
1 y1 = df1['PlayTennis']
2 x1 = df1.drop(['PlayTennis'], axis = 1)
In [26]:
Out[26]:
In [27]:
1 df2.head()
Out[27]:
3 Manager 4 80000
In [28]:
1 x2 = df2.iloc[:, 1:2].values
2 y2 = df2.iloc[:, 2].values
In [29]:
Out[29]:
In [30]:
1 # ID3
2 from sklearn import tree
3 clf3 = tree.DecisionTreeClassifier(criterion = 'entropy')
4 clf3 = clf3.fit(x1, y1)
5 tree.plot_tree(clf3)
Out[30]: