how to import logistic regression in python code example
Example 1: logistic regression algorithm in python
from sklearn.linear_model import LogisticRegression
logreg = LogisticRegression()
logreg.fit(X_train,y_train)
y_pred=logreg.predict(X_test)
Example 2: importing logistic regression
sklearn.linear_model.LogisticRegression
Example 3: logistic regression algorithm in python
print("Accuracy:",metrics.accuracy_score(y_test, y_pred))
print("Precision:",metrics.precision_score(y_test, y_pred))
print("Recall:",metrics.recall_score(y_test, y_pred))
Example 4: logistic regression algorithm in python
from sklearn import metrics
cnf_matrix = metrics.confusion_matrix(y_test, y_pred)
cnf_matrix