LOGISTIC REGRESSION - Jupyter Notebook
LOGISTIC REGRESSION - Jupyter Notebook
In [10]: iris=load_iris()
In [11]: x=iris.data
y=iris.target
x_train,x_test,y_train,y_test=train_test_split(x,y,test_size=0.3,random_state=4
In [13]: logreg_model=logistic_regression_model()
In [15]: logreg_model.fit(x_train,y_train)
Out[15]: LogisticRegression()
In [18]: y_pred=logreg_model.predict(x_test)
In [19]: logreg_model.score(x_test,y_test)
Out[19]: 1.0
In [20]: coeff=logreg_model.coef_
coeff
In [24]: df=pd.DataFrame(data=np.reshape(a=[y_test,y_pred],newshape=(len(y_test),2)),col
In [28]: df.head(10)
Out[28]:
test prediction
0 versicolor setosa
1 virginica versicolor
2 versicolor setosa
3 versicolor virginica
4 versicolor versicolor
5 virginica setosa
6 setosa setosa
7 setosa versicolor
8 virginica versicolor
9 versicolor virginica
In [ ]: