Data Science SQL

Root mean squared error

SELECT SQRT(AVG(POWER(y - y_pred, 2))) AS rmse FROM ...

Mean absolute error

SELECT AVG(ABS(y - y_pred)) AS mae FROM ...

Mean error

SELECT AVG(y_pred - y) AS me FROM ...

Median - get it here


Published September 10, 2015

You might also enjoy

Introducing Archer: Rails Console History for Heroku, Docker, and More

Blind Index 1.0

navigator.sendBeacon and Rails

All code examples are public domain.
Use them however you’d like (licensed under CC0).