Complete the code to import the linear regression model from scikit-learn.
from sklearn.linear_model import [1]
The LinearRegression class is used to create a linear regression model in scikit-learn.
Complete the code to create a linear regression model object.
model = [1]()We create a linear regression model by calling LinearRegression().
Fix the error in the code to fit the model with features X and target y.
model.fit([1], y)y as the first argument.The fit method requires the features as the first argument, which is X.
Fill both blanks to predict target values using the model and features X.
predictions = model.[1]([2])
fit instead of predict.Use predict method with features X to get predictions.
Fill all three blanks to create a dictionary of feature names and their coefficients from the model.
coef_dict = { [1]: [2] for [3], coef in zip(feature_names, model.coef_) }We create a dictionary where keys are feature names and values are coefficients. The loop variable for names is name and for coefficients is coef.