Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the Ridge 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 Lasso regression model with alpha set to 0.1.
ML Python
model = Lasso(alpha=[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 a Ridge model to data X and y.
ML Python
model = Ridge(alpha=1.0) model.[1](X, y)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to create a dictionary of coefficients from a trained Lasso model for features in feature_names.
ML Python
coef_dict = {feature: model.[1][i] for i, feature in enumerate([2])} Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to compute the mean squared error (MSE) between true values y_true and predicted values y_pred.
ML Python
from sklearn.metrics import [1] y_pred = model.predict(X_test) mse = [2](y_true, [3])
Drag options to blanks, or click blank then click option'
Attempts:
3 left