Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the LinearRegression class 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 LinearRegression 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.[1](X, 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 model's R² score.
ML Python
predictions = model.[1](X_test) score = model.[2](X_test, y_test)
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 after training.
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