mean squared error python

from sklearn.metrics import mean_squared_error
mean_squared_error(y_true, y_pred)

Here is what the above code is Doing:
1. We are creating a model using the LinearRegression class from the sklearn.linear_model module.
2. We are training the model using the fit() method.
3. We are making predictions using the predict() method.
4. We are calculating the MSE using the mean_squared_error() function from the sklearn.metrics module.

Note that we are using the entire dataset to train the model. This is not a good idea. We will learn how to split the dataset into training and test sets in the next section.