import numpy as np import pandas as pd from sklearn.metrics import roc_curve from sklearn.metrics import roc_auc_score import matplotlib.pyplot as plt
input_Cef = pd.read_csv("input_Cef.csv") input_Cef.head() X = input_Cef.iloc[:,1:6027] y = input_Cef["Ceftazidim_S.vs.R"]
# Step 1. Import the model & Splitting Data into Training and Test Sets from sklearn.linear_model import LogisticRegression X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.20,random_state=0)
# Make an instance of the Model # all parameters not specified are set to their defaults # Changing the solver had a minor effect on accuracy, but at least it was a lot faster logreg = LogisticRegression(solver = 'lbfgs')
# Step 3. Training the model logreg.fit(X_train, y_train)
#Step 4. Predict labels for new data y_pred = logreg.predict(X_test)
# Step5: Measuring Model Performance # accuracy , precision, recall, F1 Score, ROC Curve