Evaluation of Generalized Linear Model in Machine Learning

1 view (last 30 days)
Hi,I have this line of code which help to fit a normal distribution curve over my predictors.The problem is I have searched through whole of the GLM page and could not find the appropriate function which would enable to find the RMSE of my model. Further more I was looking for appropriate function that would give the error obtained from the testing set. Do it have to call the predict method manually, is there a more automatic process for it. Thanks.
mdl = GeneralizedLinearModel.stepwise(X,Y,'linear','distr','normal')

Accepted Answer

Star Strider
Star Strider on 26 May 2014
Probably the easiest way:
r = mdl.Residuals.Raw
RMSE = sqrt(mean(r.^2));
  3 Comments
Motiur
Motiur on 26 May 2014
Is there a general formula for finding R-squared using the raw residuals.I want to find R-squared and RMSE for ensemble methods; and at the end compare with the linear model and GLM.
Star Strider
Star Strider on 26 May 2014
Yes. See the documentation for Coefficient of Determination (R-Squared) for calculation details.
SSR is the regression sum of squares, the sum of squared deviations of the fitted values from their mean.
SSE is the sum of squared errors (residuals).
SST is the total sum of squares, the sum of squared deviations of y from mean(y).
These are probably easy to code, possibly with an ‘anonymous function’. (I haven’t coded them because I get them from the functions.) I suggest you get them from the structures returned by the functions, and store them in a ‘.mat’ file for future reference if you’re going to be using them more than once.

Sign in to comment.

More Answers (0)

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!