# What would be the mse (mean squared error) of my scaled dataset on the original scale?

I build an LSTM model on a standardized dataset using sklearn's MinMaxScaler. All values of the dataset are between 0 and 1. Features and target variables were standardized between 0 and 1. I achieve an mse of around 0.02 .

Now this mse is valid for the standardized dataset. What would the mse be on the original scale? Let's say the original scale is dollars. What would an mse of 0.02 be on the original scale in dollars?

TLDR: You need to multiply your scaled mse by $$(max - min)^2$$.
Let's give our values some names: Let $$y_n$$ denote the dependant variable, $$m$$ be the number of observations \begin{align*} & min := \min\limits_{n} y_n, \\ & max := \max\limits_{n} y_n \end{align*} and let $$p_n'$$ be the (scaled) predicted value for $$y_n$$. The scaled value $$y_n'$$ for $$y_n$$ is given by $$y_n' = \frac{y - min}{max - min}.$$ So scaled mse that you calculated is given by $$0.02 = mse_{\text{scaled}} = \frac1m \sum\limits_n |y_n' - p_n'|^2 = \frac1m \sum\limits_n |\frac{y - min}{max - min} - p_n'|.$$ In order to get the true mse, you want to rescale $$y_n'$$ to $$y_n$$ and $$p_n'$$ to $$p_n$$ using $$p_n' = \frac{p_n - min}{max - min}.$$ This gives us \begin{align*} mse_{\text{scaled}} & = \frac1m \sum\limits_{n} |\frac{y_n - min}{max - min} - \frac{p_n - min}{max - min}|^2 \\ & = \frac1m \sum\limits_{n} |\frac{y_n}{max - min} - \frac{min}{max - min} - \frac{p_n}{max - min} + \frac{min}{max - min}|^2 \\ & = \frac1m \sum\limits_{n} |\frac{y_n}{max - min} - \frac{p_n}{max - min}|^2 \\ & = \frac{1}{(max - min)^2} \frac1m \sum\limits_{n} |y_n - p_n|^2. \end{align*} Rearraging this gives us $$mse_{\text{original}} = \frac1m \sum\limits_{n} |y_n - p_n|^2 = (max - min)^2 mse_{\text{scaled}}.$$
• The inverse transformation also adds $min$ in addition to multiplying by $max - min$. – NiklasvMoers Jun 3 '20 at 8:28
• You don't need to use a scikit function, you can just multiply your value (0.02) by $(max - min)^2$ using the maximum and minimum value of your unscaled dependant variable. So if you have values from 10 to 100, you would get $0.02 * (100-10)^2 = 162$. – NiklasvMoers Jun 3 '20 at 8:45