text_plain_output_1.png
from sklearn.linear_model import LogisticRegression

from sklearn.metrics import accuracy_score, confusion_matrix, f1_score, precision_score, recall_score

model = LogisticRegression()
model.fit(X_train, y_train)

X_train_prediction = model.predict(X_train)
training_data_accuracy = accuracy_score(y_train, X_train_prediction)
training_data_accuracy

X_test_prediction = model.predict(X_test)
test_data_accuracy = accuracy_score(y_test, X_test_prediction)
test_data_accuracy

f1s = f1_score(y_test, X_test_prediction)
ps = precision_score(y_test, X_test_prediction)
rs = recall_score(y_test, X_test_prediction)
print('The evaluation metrics are given below: \nf1_score:', f1s, '\nprecision_score:', ps, '\nrecall_score:', rs)