Complete the code to create a simple linear regression model using scikit-learn.
from sklearn.linear_model import [1] model = LinearRegression()
The correct class to create a linear regression model is LinearRegression from sklearn.linear_model.
Complete the code to fit the linear regression model with features X and target y.
model.[1](X, y)The fit method trains the model using the features X and target y.
Fix the error in the code to predict target values using the trained model.
predictions = model.[1](X_test)To get predictions from the model, use the predict method on the test features.
Fill both blanks to calculate the mean squared error between true and predicted values.
from sklearn.metrics import [1] mse = [2](y_true, y_pred)
The function mean_squared_error calculates the average squared difference between true and predicted values.
Fill all three blanks to create a dictionary of predictions for each test sample with keys as sample indices.
pred_dict = [1](i: [2] for i, [3] in enumerate(y_pred))
The dict function creates a dictionary. The comprehension uses i as key and value as value from enumerated predictions.
