You may accomplish this in two ways:
R Squared is a metric that determines how much of the variation in the dependent variable can be explained by the variance in the independent variables. R-squared reflects the scatter around the line of best fit, whereas the coefficients estimate trends.
However, adding another independent variable to a model always raises the R-squared value, thus a model with many independent variables may appear to have a better fit even if it isn’t. This is where adjusted R2 enters the picture. Each new independent variable is compensated for by the modified R2, which only rises if each variable improves the model beyond what is conceivable by chance. Because we’re building a multiple regression model, this is crucial.
Cross-validation is a widely used approach that divides data into two sets: training and testing data.