# Online Static Security Assessment of Power Systems Based on Lasso Algorithm
## 3 Principles of Multi-Step Adaptive Lasso Regression Algorithm (MSA-Lasso)
### Algorithm Model  
As a supervised machine learning algorithm, the original training set of this problem is:  
\[TS=\left[\left(x_{1}^{(0)},y_{1}^{(0)}\right),\cdots,\left(x_{i}^{(0)},y_{i}^{ (0)}\right),\cdots,\left(x_{S}^{(0)},y_{S}^{(0)}\right)\right] \tag{1}\]  
where \(x_{i}^{(0)}\) is the \(i\)th original observation vector that is constructed by controlled variables in this paper, \(y_{i}^{(0)}\) is the \(i\)th original response, which is the security index in this paper, and \(S\) is the size of the training set. Generally, the original observation data \(x_{i}^{(0)}\) needs to be standardized, while \(y_{i}^{(0)}\) needs to be zero-centered; the post-treatment data \(x_{i}\) and \(y_{i}\) are defined as:  
\[\begin{array}{l}x_{i}=\frac{x_{i}^{(0)}-\mu_{y}}{std_{x}}\\ y_{i}=y_{i}^{(0)}-\mu_{y}\end{array} \tag{2}\]  
where \(\mu_{x}\) and \(\mu_{y}\) are respectively the means of \(x_{i}^{(0)}\) and \(y_{i}^{(0)}\), and \(std_{x}\) denotes the standard deviation of \(x_{i}^{(0)}\). After the process, it can be ensured that \(\sum\limits_{i=1}^{S}x_{i}=0\), \(\sum\limits_{i=1}^{S}x_{i}^{2}=1\), and \(\sum\limits_{i=1}^{S}y_{i}=0\).  
Taking two-dimensional data as an example, the effect after the treatment of centralization and standardization are shown in Figure 1. From the figure, it can be clearly seen that centralization moves the center of the data to the origin point, and standardization ensures that the scale of the data have the same value in each dimension.  
Figure 1: The effect after the treatment of data. (**a**) Original data; (**b**) Centralized data; (**c**) Standardized data.  
The regression algorithm is based on the following simplified linear model [33]:  
\[\mathbf{Y}=\mathbf{X}\sigma+\varepsilon \tag{3}\]  
where \(\mathbf{Y}\) is the vector consisting of responses, and \(\mathbf{Y}=[y_{1},\cdots,y_{i},\cdots,y_{S}]^{T}\); \(\mathbf{X}\) is the \(S\times D\) design observation matrix, which is formed by observation of \(x_{1},\cdots,x_{i},\cdots,x_{S}\), and the observation \(x_{i}\), which includes \(D\) variables, has the corresponding response \(y_{i}\); \(\sigma=[\sigma_{1},\cdots,\sigma_{i},\cdots,\sigma_{D}]^{T}\) is the vector of regression coefficients; and \(\varepsilon=[\varepsilon_{1},\cdots,\varepsilon_{i},\cdots,\varepsilon_{S} ]^{T}\) is the vector of random variables produced by the innovation process. For obtaining regression coefficients \(\sigma\), the linear model can be solved via the least square (LS) method. The cost function \(f(\sigma)\) of the optimization problem is described as:  
\[\text{min}f_{ls}(\sigma)=\frac{1}{S}\|\mathbf{Y}-\mathbf{X}\sigma\|^{2}=\frac {1}{S}\underset{i=1}{\overset{S}{\sum}}(y_{i}-x_{i}\sigma)^{2} \tag{4}\]  
The regression coefficients can be obtained, and the expression of estimates \(\hat{\sigma}\) is:  
\[\hat{\sigma}=\left(\mathbf{X}^{T}\mathbf{X}\right)^{-1}\mathbf{X}^{T}\mathbf{Y} \tag{5}\]  
If the estimates \(\hat{\sigma}\) exist, the only condition is that \(\mathbf{X}\) is a full matrix. However, even though the condition is satisfied, large relevance features of observation data will cause big errors. Therefore, the regression algorithm is proposed to improve the situation.