## 4 Case Studies
### Modeling and Simulation Process  
To fully utilize the data, we select each feature vector as test data in turn and choose the training data randomly among the other 309 vectors. It is important to note here that the amount of training data is one of the parameters we are examining, and thus it varies from one experiment to the next. The distribution of the four classes in the training data is required to be similar to the distribution in the entire dataset. For the SVM method, the LibSVM software (version 3.22, Chih-Chung Chang and Chih-Jen Lin, Taipei) was used to build the classification model [62]. The C-SVC model with RBF kernel and a basic grid search method with cross-validation was used to seek out the best penalty parameter \(c\) and kernel parameter \(\sigma\). For the KNN method, the distances between all the features are calculated in Euclidean space by formula (12):  
\[D_{i,j}=\sqrt{\left(\hat{F}_{i,1}-\hat{F}_{j,1}\right)^{2}+\left(\hat{F}_{i,2} -\hat{F}_{j,2}\right)^{2}+\left(\hat{F}_{i,3}-\hat{F}_{j,3}\right)^{2}+\left( \hat{F}_{i,4}-\hat{F}_{j,4}\right)^{2}+\left(\hat{F}_{i,5}-\hat{F}_{j,5}\right) ^{2}+\left(\hat{F}_{i,6}-\hat{F}_{j,6}\right)^{2}}. \tag{12}\]  
For a certain test data point, its GWC is voted on by the first \(K\) nearest neighbors in the Euclidean space of training data. In most cases, there will be only two GWCs participating in the vote due to the distribution of feature vectors. Therefore, \(K\) should be an odd number to prevent a tied vote. The particular simulation process utilized in this work is shown in Figure 9 and can be summarized in the following steps:  
Step 1. Select the sample data day \(F_{in,i}\) (\(i=1,2\,\dots\) or \(310\)). Step 2. Select \(N_{t}\) training data among the rest of the 309 days with an approximate GWC ratio of A, B, C and D at 24:119:148:19. Step 3. Estimate the GWC of the selected sample data with the SVM and KNN methods. Step 4. Record the classification results with different sample data \(F_{in,i}\) (\(i\in[1,310]\)), different training data quantity \(N_{t}\) (\(N_{t}\in[40,300]\)), different methods (SVM or KNN) and different parameter \(K\) of KNN (\(K=1,3\,\dots,21\)). Step 5. Calculate the performance indexes of the recorded results. A confusion matrix, as defined in formula (13), is applied to describe the classification results:  
\[M=\left[ \begin{array}{ccc}m_{1,1}&\cdots&m_{1,k}\\ \vdots&&\vdots\\ m_{k,1}&\cdots&m_{k,k}\end{array} \right]=\left[m_{i,j}\quad\right](i,j=1, \cdots,k), \tag{13}\]  
where \(m_{i,j}\) is the number of objects that belong to the class \(i\) but are classified into the class \(j\), and \(K\) is the number of total categories. Three indexes are calculated based on the confusion matrix to evaluate the performance from different perspectives:Overall accuracy (OA) \[OA=\frac{\sum_{i=1}^{k}m_{i,i}}{\sum_{i=1}^{k}\sum_{j=1}^{k}m_{i,j}},\] (14) Product's accuracy (PA) \[PA_{i}=\frac{m_{i,i}}{\sum_{j=1}^{k}m_{i,j}}i=1,\cdots,k,\] (15) User's accuracy (UA) \[UA_{i}=\frac{m_{i,i}}{\sum_{j=1}^{k}m_{j,i}}i=1,\cdots,k.\] (16)  
The overall accuracy (OA) is the indicator to describe the classification accuracy of all the outputs. The product's accuracy (PA) and user's accuracy (UA), respectively, evaluate the performance from the tester and user's points of view. For a tester, the actual class of a sample is known, and the PA is used to describe the accuracy of this particular class. For users, they are more concerned about if the given classification result is correct and UA can be used to characterize the credibility of the output. Step 6. Repeat the above steps 1-5 one hundred times, with the training data being selected randomly. The randomness of training data may lead to a one-sided model and result, so we try to reduce this randomness by multiple computing and then taking the average. Step 7. Calculate the mean value of OA, PA, and UA with different training data quantity \(N_{t}\), various methods (SVM or KNN) and different parameter \(K\) of KNN.