## 3 Methods
### Support Vector Regression  
Support vector regression has been vastly employed in general for renewable power generation applications [30] and in particular for several kinds of problem in wind energy, such as, for example, operation curve analysis [31; 32], wind farm layout optimization [33], and forecasting [34; 35]. Here follows a brief recap of the principles of support vector regression, starting from a linear model that is given in Equation (3):  
\[y=\mathbf{x}\beta+\epsilon, \tag{3}\]  
Figure 2: Schematic of the overall process for fault detection. where \(\beta\) is a vector of regression coefficients, whose best estimate has to be inferred from the input variable data matrix \(x\) and the output vector \(y\). Support vector regression is a methodology for estimating the \(\beta\) parameters, given the matrix of input variables \(x\) and the vector of output \(y\). It is a constrained optimization problem, because the objective of this kind of regression is the minimum norm of \(\beta^{\prime}\beta\), subjected to the request that the residuals between the measurements \(y\) and the model estimate \(f(x)\) are lower than a threshold \(\epsilon\) for each \(n\)-th observation (Equation (4)):  
\[|y_{n}-\mathbf{x}_{n}\beta+b_{n}|\leq\epsilon. \tag{4}\]  
The optimization problem can be rephrased in the Lagrange dual formulation; the function to minimize is \(L(\alpha)\), given in Equation (5):  
\[L(\alpha)=\frac{1}{2}\sum_{i=1}^{N}\sum_{j=1}^{N}(\alpha_{i}-\alpha_{i}^{*}) \Big{(}\alpha_{j}-\alpha_{j}^{*}\Big{)}\mathbf{x}_{i}^{\prime}\mathbf{x}_{j}+\epsilon \sum_{i=1}^{N}(\alpha_{i}+\alpha_{i}^{*})+\sum_{i=1}^{N}y_{i}(\alpha_{i}^{*}- \alpha_{i}), \tag{5}\]  
with the constraints (Equation (6))  
\[ \begin{split}\sum_{n=1}^{N}(\alpha_{n}-\alpha_{n}^{*})=0\\ 0\leq\alpha_{n}\leq C\\ 0\leq\alpha_{n}^{*}\leq C,\end{split}  \tag{6}\]  
where \(C\) is the box constraint. The solution for the \(\beta\) parameters in terms of the input variable matrix \(x\) and of the coefficients \(\alpha_{n}\) or \(\alpha_{n}^{*}\) is given in Equation (7):  
\[\beta=\sum_{n=1}^{N}(\alpha_{n}-\alpha_{n}^{*})\mathbf{x}_{n}. \tag{7}\]  
The interpretation of Equation (7) is that the algorithm selects the most meaningful observations (rows of the \(x\) matrix) by setting most of the \(\alpha\) or \(\alpha^{*}\) coefficients to zero. The observations associated to non-vanishing \(\alpha\) or \(\alpha^{*}\) are consequently called support vectors. Once the \(\beta\) coefficients have been computed on a reference data set as in Equation (7), given a new input variable \(\mathbf{x}^{\prime}\) it is possible to simulate the output by multiplying \(\mathbf{x}^{\prime}\) and \(\beta\) (Equation (8)):  
\[f(\mathbf{x})=\sum_{n=1}^{N}(\alpha_{n}-\alpha_{n}^{*})\mathbf{x}_{n}^{\prime}\mathbf{x}+ \mathbf{b}. \tag{8}\]  
A non-linear support vector regression is obtained by replacing the products between the observation matrix with a non-linear kernel function (Equation (9)):  
\[G(\mathbf{x}_{1},\mathbf{x}_{2})=\langle\varphi(\mathbf{x}_{1})\varphi(\mathbf{x}_{2})\rangle, \tag{9}\]  
where \(\varphi\) is a transformation mapping the \(\mathbf{x}\) observations into the feature space. A Gaussian kernel selection is given in Equation (10):  
\[G\big{(}\mathbf{x}_{i},\mathbf{x}_{j}\big{)}=e^{-\kappa\big{\|}\mathbf{x}_{i}-\mathbf{x}_{j} \big{\|}^{2}}, \tag{10}\]  
where \(\kappa\) is the kernel scale. Then Equation (5) can be rewritten as Equation (11):  
\[L(\alpha)=\frac{1}{2}\sum_{i=1}^{N}\sum_{j=1}^{N}(\alpha_{i}-\alpha_{i}^{*}) \Big{(}\alpha_{j}-\alpha_{j}^{*}\Big{)}G\big{(}\mathbf{x}_{i},\mathbf{x}_{j}\big{)}+ \epsilon\sum_{i=1}^{N}(\alpha_{i}+\alpha_{i}^{*})+\sum_{i=1}^{N}y_{i}(\alpha _{i}^{*}-\alpha_{i}), \tag{11}\]and Equation (8) for predicting can be rewritten as Equation (12):  
\[f(\mathbf{x})=\sum_{n=1}^{N}(\alpha_{n}-\alpha_{n}^{*})G(\mathbf{x}_{n},\mathbf{x})+\mathbf{b}. \tag{12}\]  
In this work, the hyperparameters of the regression \(\kappa\), \(C\), \(\epsilon\) were automatically optimized using Python.