# Data-Driven Prediction Method for Power Grid State Subjected to Heavy-Rain Hazards
## 5 Method and Materials
### Svm  
SVM is a general approach to supervised learning for classification via the definition of a separating hyperplane, which allows discrimination between classes. It is widely used for classifying binary problems. The optimal hyperplane is considered as the hyperplane with the maximal margin between the classes, which decreases the probability of misclassification and increases the generalization of the model. The following paragraphs briefly demonstrate the SVM model in three-dimensional space for a binary classification problem. The theoretical details of SVM can be found in the literature [35]. Consider \(n\) observations \(x_{i}\in R^{3}\), \(i=1,\ \ldots,\ n\) with corresponding target values \(t_{1},\ \ldots,\ t_{n}\), where \(t_{n}\in\{-1,\ 1\}\), and new data points x are classified according to the sign of \(y\big{(}w^{T}x+b\big{)}\), where \(w\) is the weight vector that defines a direction perpendicular to the hyperplane of the decision boundary plane, while \(b\) is a bias that moves the hyperplane parallel to itself. The optimal decision boundary plane given by the support vector can be found by solving the optimization problem, as follows:  
\[min\frac{1}{2}||w^{2}||+C\sum_{i=1}^{n}\xi_{i}subject\ to\ \ \ \ \ t_{i}\Big{(}w^{T}x_{i}+b\Big{)}\ \ \geq\ \ 1-\xi_{i}\xi_{i}\geq\ \ 0,\ \ i=1,\ \ldots,\ n, \tag{2}\]  
where \(\xi_{i}\) is a slack variable that regularizes the weight of misclassified data points inside the margin. C is a penalty coefficient that controls the trade-off between the margin and classification error. In the aforementioned formulation, increasing C toward \(\infty\) places more weight on the slack variables \(\xi_{i}\), and the optimization attempts to make a stricter separation, whereas reducing C towards 0 reduces \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **Wind + Rain** & **Only Wind** & **Only Rain** \\ \hline R-squared & 0.0821 & 0.0728 & 0.03 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: R-squared values of the models. the importance of misclassification. This'soft-margin' formulation can be re-formulated using the Lagrange multiplier \(\alpha\), as follows:  
\[max-\frac{1}{2}\sum_{i=1}^{n}\sum_{j=1}^{n}\alpha_{i}\alpha_{j}t_{i}j\Big{(}x_{ i},x_{j}\Big{)}+\sum_{i=1}^{n}\alpha_{i}subject\text{ to }0\leq\alpha\leq C,\sum_{i=1}^{n}\alpha_{i}t_{i}=0. \tag{3}\]  
The solution of the soft-margin problem is usually found via sequential minimal optimization (SMO) [36]. SMO iteratively selects and optimizes two Lagrange multipliers until convergence at an optimal solution. Figure 4 shows the support vectors and hyperplane in a separable two-class classification of SVM. Figure 4 shows the support vectors and hyperplane for separating outages from no outages, based on the associated weather variables. The finding of the best hyperplane assumes that the data is linearly separable; however, typical data often has non-linear characteristics. The kernel trick can be used to map the non-linear input space into a linear separable feature space. In this study, we applied the radial basis kernel trick function, \(k\Big{(}x_{i},x_{j}\Big{)}\). This can be replaced as the dot product of x in another space. The radial basis function kernel (RBF) can be expressed as follows:  
\[k\Big{(}x_{i},x_{j}\Big{)}=e^{-\frac{1}{2\alpha^{2}}\left|\frac{x_{i}-x_{j}}{ \left|x_{i}-x_{j}\right|^{2}}}, \tag{4}\]  
where \(\sigma^{2}\) represents the kernel parameter. The best kernel should be found by an experiment while adjusting kernel parameters via a search method to minimize the error of the model. Furthermore, the performance of the general SVM algorithm tends to be lower for an imbalanced ratio dataset as the separating boundary tends toward the minority class to obtain better classification accuracy. Therefore, in order to obtain an effective classification model, the separating boundary needs to be pushed toward the majority class and away from the minority class.