Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the logistic regression model from scikit-learn.
ML Python
from sklearn.linear_model import [1]
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to create a logistic regression model with default settings.
ML Python
model = [1]() Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in the code to fit the logistic regression model on features X and labels y.
ML Python
model.[1](X, y) Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardComplete the code to predict labels for X_test and calculate accuracy against y_test.
ML Python
predictions = model.[1](X_test)
accuracy = accuracy_score(y_test, predictions,) Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to create a logistic regression with L2 penalty, fit it, and print the accuracy score.
ML Python
model = LogisticRegression(penalty=[1]) model.[2](X_train, y_train) print(accuracy_score(y_train, model.[3](X_train)))
Drag options to blanks, or click blank then click option'
Attempts:
3 left