# Blog

## 5000+ Members

### MEETUPS

LEARN, CONNECT, SHARE

### JOB POSTINGS

INDEED POSTINGS

Browse through the latest deep learning, ai, machine learning postings from Indeed for the GTA.

### CONTACT

CONNECT WITH US

Are you looking to sponsor space, be a speaker, or volunteer, feel free to give us a shout.

# [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