## Wrong MSE formula on orngStat

**Forum rules**

Archived/read-only, please use our ticketing system for reporting bugs and their discussion.

2 posts
• Page

**1**of**1**### Wrong MSE formula on orngStat

On the method MSE of orngStat, the calculation of RMSE (when given the argkw "sqrt") it calculates the RMSE by making the squared root of the sum of the squared errors, and then divide it by the number of examples.

Instead, at least I suppose, it should calculates the RMSE by dividing the the sum of the squared errors by the number of examples and, only then, make the squared root of it.

Citation from http://www.statsoft.com/textbook/glosr.html:

To calculate the RMS (root mean squared) error, the individual errors are squared, added together, divided by the number of individual errors, and then square rooted.

So around line 125 it is:

and I propose instead:

Am I correct, or was this intended by the coders?

Instead, at least I suppose, it should calculates the RMSE by dividing the the sum of the squared errors by the number of examples and, only then, make the squared root of it.

Citation from http://www.statsoft.com/textbook/glosr.html:

To calculate the RMS (root mean squared) error, the individual errors are squared, added together, divided by the number of individual errors, and then square rooted.

So around line 125 it is:

- Code: Select all
`if argkw.get("sqrt", 0):`

MSEs = [math.sqrt(x) for x in MSEs]

return [x/totweight for x in MSEs]

and I propose instead:

- Code: Select all
`if argkw.get("sqrt", 0):`

MSEs = [x/totweight for x in MSEs]

return [math.sqrt(x) for x in MSEs]

return [x/totweight for x in MSEs]

Am I correct, or was this intended by the coders?

Thanks, this was indeed the error in the old code. I have reimplemented regression scoring part quite a number of months back (please update this and other libraries), and I believe the new code should be correct (computes the square root at the end). The scores that we use and their exact formulas are in orngStat documentation.

2 posts
• Page

**1**of**1**