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 LinearRegression model = LinearRegression([1])
Drag options to blanks, or click blank then click option'
Attempts:
3 left
2fill in blank
mediumComplete the code to train the linear regression model on data X and 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 make predictions 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 coefficients for each feature with their names.
ML Python
coef_dict = {{ [1]: [2] for [3], coef in zip(feature_names, model.coef_)} Drag options to blanks, or click blank then click option'
Attempts:
3 left