Complete the code to import the LinearRegression class from scikit-learn.
from sklearn.linear_model import [1]
The LinearRegression class is imported from sklearn.linear_model to create a linear regression model.
Complete the code to create a LinearRegression model instance.
model = [1]()We create an instance of LinearRegression to train and predict with a linear model.
Fix the error in the code to train the model with features X and target y.
model.[1](X, y)The fit() method trains the model using the input features X and target y.
Fill both blanks to predict target values and calculate the model's R² score.
predictions = model.[1](X_test) score = model.[2](X_test, y_test)
Use predict() to get predictions from the test features, and score() to calculate the R² score comparing predictions to true values.
Fill all three blanks to create a dictionary of coefficients, intercept, and R² score after training.
results = {
'coefficients': model.[1],
'intercept': model.[2],
'r2_score': model.[3](X_test, y_test)
}After training, model.coef_ gives coefficients, model.intercept_ gives intercept, and model.score() computes R² score.
