Comments

Measures for In-Sample Evaluation




By using the numerical value it could measure how the model is fitted to the data. 
There are two type of it: 
1- Mean Squared Error (MSE):
 find the between predict and actual value then square it and divided by the number of samples;
The Code

from sklearn.metrics import mean_squared_error
mean_squared_error(df['price'], Y_predict_simple_fit)

2-R-squared(R^2): [0,1]
It measure how close the data to the fitted regression line and it is the percentage of variation of the target variable (Y) that is explain by the linear model.
 
\[R^{2} = (1-\frac{MSE of regressionline}{MSE of teh average of the data})\]

The Code: 
X = df[['highway-mpg']]
Y = df['price']
lm.fit(X, Y) // if the result is negative so there are overfitting must be solve





Share on Google Plus

About Inas AL-Kamachy

    Blogger Comment
    Facebook Comment

0 Comments:

Post a Comment