Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the linear 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 linear regression model instance.
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 train the model with features X and target y.
ML Python
model.fit([1], y) Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to predict target values and calculate the mean squared error.
ML Python
predictions = model.[1](X_test) mse = mean_squared_error(y_test, [2])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
5fill in blank
hardFill all three blanks to create a dictionary of coefficients, intercept, and R² score.
ML Python
results = {
'coefficients': model.[1],
'intercept': model.[2],
'r2_score': model.[3](X_test, y_test)
} Drag options to blanks, or click blank then click option'
Attempts:
3 left