# GPFlow: Gaussian Process Uncertainty Quantification

I trained some Gaussian process model with the Python library GPFlow on a dataset consisting of $$(X, Y)$$, inputs and outputs, in a regression setting. This model gives me pretty good predictions in the sense that the relative error is small almost everywhere. I want to use the uncertainty as well, which is given in a GPFlow setting in the form of a standard deviation (STD) associated with every prediction. Here's my problem: I normalised both inputs and outputs before training (separately) using sklearn's StandardScaler (effectively making the data normally distributed with $$0$$ mean and unit STD). So the STD given by the model pertains to the scaled data. How do I "rescale" the uncertainty estimates of the GP to the actual data? Using the inverse_transform function of the output scaler makes little sense. This issue might be easier solvable if I scaled with a MinMaxScaler (squishing all data points into the unit interval) by dividing by the length of the range of the original output set (at least I think it works that way). But how about the case of the StandardScaler? Any insights will be appreciated!

• I think it works by computing an interval of 1 STD around the predictions and then rescaling both interval boundaries, which should yield the corresponding interval on the original data set, irrespective of the way we scale.
– Leon
Feb 6, 2019 at 10:58

Not sure about which function to call in GPFlow, but the principle is simple. If your $$Y$$ data was scaled:
$$Y_{scaled} = {(Y - mean(Y)) \over {sd(Y)}}$$
So now if you have any prediction (from the scaled model) $$\hat{Y}_{scaled}$$, with stand error $$\sigma_{\hat {Y}_{scaled}}$$, then it is a normal distribution $${\cal N}(\hat {Y}_{scaled}, \sigma^2_{\hat {Y}_{scaled}})$$. Then you can very easily rescale it back to the original scale $${\cal N}(\hat {Y}, \sigma^2_{\hat {Y}})$$, where:
$$\hat {Y} = \hat {Y}_{scaled}\cdot sd(Y) + mean(Y)$$ $$\sigma_{\hat {Y}} = \sigma_{\hat {Y}_{scaled}} \cdot sd(Y)$$