[D] Calculating the confidence interval for RMSE
I’m reading a book on machine learning where the author uses the Random Forest Regression model to fit a dataset. The confidence interval for the root mean squared error is then computed using the following code.
Does anyone know why the code works? Under what assumptions does the sum of squared errors follow a generalized t distribution (unintuitive to me, I feel like it should follow a ${chi}^2$ distribution?
from scipy import stats confidence = 0.95 squared_errors = (final_predictions - y_test) ** 2 #y_test is real values, final_predictions is predicted values of y ci = np.sqrt(stats.t.interval(confidence, len(squared_errors) - 1, loc=squared_errors.mean(), scale=stats.sem(squared_errors)))
submitted by /u/this_nicholas
[link] [comments]