Pract5 1
Pract5 1
Roll No :- 02
In [37]: df=pd.read_csv("Social_Network_Ads.csv")
In [38]: df
In [39]: df.isnull().sum()
Out[39]: User ID 0
Gender 0
Age 0
EstimatedSalary 0
Purchased 0
dtype: int64
In [41]: x.isnull().sum()
Out[41]: Age 0
EstimatedSalary 0
dtype: int64
In [42]: y.isnull().sum()
Out[42]: 0
In [45]: x_test.shape
Out[45]: (120, 2)
In [48]: x_train
In [49]: y_train
Out[49]: 318 1
23 1
155 0
40 0
123 0
..
184 0
293 0
75 1
366 1
355 1
Name: Purchased, Length: 280, dtype: int64
In [50]: model.fit(x_train,y_train)
Out[50]: ▾ LogisticRegression
LogisticRegression()
In [51]: y_pred=model.predict(x_test)
In [54]: print(cm)
[[77 0]
[43 0]]