# A Gaussian Process Method with Uncertainty Quantification for Air Quality Monitoring
## 2 Background Knowledge  
### Gaussian Processes  
Given a set of training data \(\mathcal{D}=\{(\mathbf{x}_{i},y_{i}),i=1,\cdots,n\}\) where \(\mathbf{x}_{i}\in\mathcal{X}\) is the input and \(y_{i}\in\mathbb{R}\) is the observation, we can determine a GP model \(f(\cdot)\) to predict \(y_{*}\) for a new input \(\mathbf{x}_{*}\). For instance, when the output is one-dimensional, the GP model is formulated as  
\[f\sim\mathcal{GP}\big{(}\bar{f}(\mathbf{x}),k(\mathbf{x},\mathbf{x}^{\prime}) \big{)},\quad y=f(\mathbf{x})+\varepsilon,\quad\varepsilon\sim\mathcal{N}(0, \sigma^{2}), \tag{1}\]  
where \(\bar{f}:\mathcal{X}\to\mathbb{R}\) is the mean function defined as  
\[\bar{f}(\mathbf{x})=\mathbb{E}\big{[}f(\mathbf{x})\big{]}, \tag{2}\]  
and \(k:\mathcal{X}\times\mathcal{X}\to\mathbb{R}\) is the kernel function ([PERSON] and [PERSON], 2016) defined as  
\[k(\mathbf{x},\mathbf{x}^{\prime})=\mathbb{E}\big{[}(f(\mathbf{x})-\bar{f}( \mathbf{x}))(f(\mathbf{x}^{\prime})-\bar{f}(\mathbf{x}^{\prime}))\big{]}, \tag{3}\]  
where \(\varepsilon\) is the additive, independent, identically distributed Gaussian measurement noise with variance \(\sigma^{2}\
eq 0\), and \(\mathbb{E}\) denotes the mathematical expectation operation. Given \(\mathbf{x}_{i}\) a \(D\times 1\) vector, the \(n\) inputs can be aggregated into a matrix \(\mathbf{X}_{D\times n}\), or briefly \(\mathbf{X}\) with the corresponding output vector \(\mathbf{y}_{n\times 1}\), or \(\mathbf{y}\). Similarly, the function values at the test inputs \(\mathbf{X}_{*}\) with dimensions of \(D\times N\) can be denoted as \(\mathbf{f}_{*}\), and we next write the joint distribution of \(\mathbf{y}\) and \(\mathbf{f}_{*}\) as  
\[ \begin{bmatrix}\mathbf{y}\\ \mathbf{f}_{*}\end{bmatrix} \sim\mathcal{N}\bigg{(}\mathbf{0}, \begin{bmatrix} \mathbf{K}_{nn}+\sigma^{2}\mathbf{I}&\mathbf{K}_{nN}\\ \mathbf{K}_{Nn}&\mathbf{K}_{NN}\end{bmatrix} \bigg{)}, \tag{4}\]  
where \(\mathbf{I}\) represents the identity matrix. \(\mathbf{K}_{nn}+\sigma^{2}\mathbf{I}\) is the \(n\times n\) prior covariance matrix of \(\mathbf{y}\) with entry \(\mathbf{K}_{ij}=k(\mathbf{x}_{i},\mathbf{x}_{j})+\sigma^{2}\delta_{ij}\), where \(\delta_{ij}\) is one iff \(i=j\) and zero otherwise, and \(\mathbf{x}_{i}\) and \(\mathbf{x}_{j}\) are column vectors from \(\mathbf{X}\). The matrix \(\mathbf{K}_{NN}\) denotes the \(N\times N\) prior covariance matrix of \(\mathbf{f}_{*}\) with entry \(\mathbf{K}_{ij}=k(\mathbf{x}_{i},\mathbf{x}_{j})\), where \(\mathbf{x}_{i}\) and \(\mathbf{x}_{j}\) are column vectors from \(\mathbf{X}_{*}\). The matrices \(\mathbf{K}_{Nn}\) and \(\mathbf{K}_{nN}\) satisfy \(\mathbf{K}_{Nn}=\mathbf{K}_{NN}^{\mathrm{T}}\), and the entry of the \(N\times n\) prior covariance matrix of \(\mathbf{f}_{*}\) and \(\mathbf{y}\) is \(\mathbf{K}_{ij}=k(\mathbf{x}_{i},\mathbf{x}_{j})\), where \(\mathbf{x}_{i}\) is a column vector from \(\mathbf{X}_{*}\) and \(\mathbf{x}_{j}\) is a column vector from \(\mathbf{X}\). By deriving the conditional distribution of \(\mathbf{f}_{*}\) from (4), where the prior mean is set to be zero for simplicity ([PERSON] and [PERSON], 2016), we have the predictive posterior at new inputs \(\mathbf{X}_{*}\) as  
\[\mathbf{f}_{*}|\mathbf{X},\mathbf{y},\mathbf{X}_{*}\sim\mathcal{N}\big{(} \bar{\mathbf{f}}_{*},\mathrm{cov}(\mathbf{f}_{*})\big{)}, \tag{5}\]  
where  
\[\bar{\mathbf{f}}_{*}\triangleq\mathbb{E}\big{[}\mathbf{f}_{*}|\mathbf{X}, \mathbf{y},\mathbf{X}_{*}\big{]}=\mathbf{K}_{Nn}\big{[}\mathbf{K}_{nn}+\sigma ^{2}\mathbf{I}\big{]}^{-1}\mathbf{y}, \tag{6}\]  
is the prediction at \(\mathbf{X}_{*}\), and  
\[\mathrm{cov}(\mathbf{f}_{*})=\mathbf{K}_{NN}-\mathbf{K}_{Nn}\big{[}\mathbf{K }_{nn}+\sigma^{2}\mathbf{I}\big{]}^{-1}\mathbf{K}_{Nn}^{\mathrm{T}}, \tag{7}\]  
denotes the covariance of \(\mathbf{f}_{*}\).