Complete the code to import the logistic regression model from scikit-learn.
from sklearn.linear_model import [1]
The logistic regression model is imported using LogisticRegression from sklearn.linear_model.
Complete the code to create a logistic regression model with default settings.
model = [1]()To create a logistic regression model, instantiate LogisticRegression().
Fix the error in the code to fit the logistic regression model on features X and labels y.
model.[1](X, y)The fit method trains the model on the data.
Complete the code to predict labels for X_test and calculate accuracy against y_test.
predictions = model.[1](X_test)
accuracy = accuracy_score(y_test, predictions,)Use predict to get predicted labels, and separate arguments with a comma in accuracy_score.
Fill all three blanks to create a logistic regression with L2 penalty, fit it, and print the accuracy score.
model = LogisticRegression(penalty=[1]) model.[2](X_train, y_train) print(accuracy_score(y_train, model.[3](X_train)))
L2 penalty is specified as 'l2'. Use fit to train and predict to get predictions for accuracy.
