Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to create a simple linear regression model using scikit-learn.
ML Python
from sklearn.linear_model import [1] model = LinearRegression()
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to fit the linear regression model with features X and target y.
ML Python
model.[1](X, y) Drag options to blanks, or click blank then click option'
Attempts:
3 left
3fill in blank
hardFix the error in the code to predict target values using the trained model.
ML Python
predictions = model.[1](X_test) Drag options to blanks, or click blank then click option'
Attempts:
3 left
4fill in blank
hardFill both blanks to calculate the mean squared error between true and predicted values.
ML Python
from sklearn.metrics import [1] mse = [2](y_true, y_pred)
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 predictions for each test sample with keys as sample indices.
ML Python
pred_dict = [1](i: [2] for i, [3] in enumerate(y_pred))
Drag options to blanks, or click blank then click option'
Attempts:
3 left