Linear Regression:
Visualization of Predicted vs Actual Values:
-
This part creates a scatter plot where the x-axis represents the actual values (y_test) and the y-axis represents the predicted values (y_pred) from the linear regression model.
-
The points on the scatter plot represent the relationship between the actual and predicted values.
-
The red dashed line represents the ideal scenario where the actual and predicted values are perfectly aligned.


Visualization of Residuals:
-
This part creates a scatter plot where the x-axis represents the predicted values (y_pred) and the y-axis represents the residuals (the difference between the actual and predicted values).
-
The residuals show the deviation of the model's predictions from the actual values.
-
The red dashed line at y=0 represents the line of zero residuals, indicating the ideal scenario where the predictions perfectly match the actual values.
The linear regression model you trained achieved excellent performance with the following metrics:
-
Mean Squared Error (MSE): 2.3084199302903913e-26
-
Coefficient of Determination (R-squared): 1.0
-
Mean Squared Error (MSE): The MSE measures the average squared difference between the predicted and actual values. In this case, the MSE is extremely low, indicating that the model's predictions are very close to the actual values. The MSE value of 2.3084199302903913e-26 indicates an almost perfect fit.
-
Coefficient of Determination (R-squared): The R-squared value represents the proportion of the variance in the dependent variable (y) that can be explained by the independent variables (X). A value of 1.0 indicates a perfect fit, meaning that all the variation in the dependent variable is captured by the independent variables. In this case, the R-squared value of 1.0 indicates that the linear regression model explains all the variability in the data.