## 3 Data Filtering for Short-Term Forecasting of Photovoltaic Power Plants Generation
### The K-Means Filtration Method  
In order to more accurately identify outliers, the authors of the study used the k-means method. The k-means method is implemented in accordance with the following algorithm [42], as shown in Figure 7 for 200 randomly generated observations and 6 cluster centers for two-dimensional space (the number of features describing each observation is 2). The step-by-step procedure of the methodology is given in Figure 8. A silhouette measure is used to assess the quality of data clustering. The silhouette measure characterizes the distance of the observation from the nearest cluster to which it does not belong. The silhouette measure is determined in accordance with the expression:  
\[Sil_{m}=\frac{B-A}{\max(A,B)} \tag{2}\]  
where \(Sil_{m}\)--the silhouette measure for the observation; \(A\)--the distance from the observation to the nearest cluster center, to which this observation belongs; \(B\)--the distance from the observation to the nearest cluster center to which this observation does not belong. By the silhouette measure value, the division quality is determined: poor division quality is characterized by the measure values from \(-1\) to \(0.2\); middle division quality--from \(0.2\) to \(0.5\); good division quality--from \(0.5\) to \(1\). To identify the transparency index \(k_{T}\) anomalous behavior and to solve the problem of more accurate outliers identification, a three-dimensional feature space was used in the study, based on the k-means clustering method. 6076 observations were analyzed for the period from 26/09/17 to 05/02/19. Cloudiness \(cc\), solar altitude angle sine \(\sin\alpha\) and solar inclination angle \(\delta\) were used as features describing the observations. Figure 7: K-means based data clustering. Solar altitude angle \(\alpha\) is determined according to the expression below:  
\[\alpha=90-\arccos(\cos\varphi\cos\delta\cos\omega+\sin\varphi\sin\delta), \tag{3}\]  
where \(\varphi\)--the latitude, (deg); \(\delta\)--the solar inclination angle, (deg); \(\omega\)--the solar hourly angle, (deg). To calculate the solar inclination angle, the following expression is used:  
\[\delta=23.45^{\circ}\sin\!\left(360^{\circ}\frac{284+n}{365}\right), \tag{4}\]  
where \(n\) is the day number. To select the number of clusters and determine the initial approximations of the cluster centers, a combination of various characteristic values of each feature was used. The list of characteristic values and the corresponding descriptions are presented in Table 3. \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Solar Altitude Angle Size** & \multicolumn{2}{c}{**Cloudiness**} & \multicolumn{2}{c}{**Solar Inclination Angle**} \\ \hline _Description_ & _Value_ & _Description_ & _Value_ & _Description_ & _Value_ \\ \hline morning/evening & 0.1 & almost no clouds & 0.1 & winter & 0.1 \\ late night/day & 0.3 & low clouds & 0.5 & off-season closer to winter & 0.33 \\ late morning & 0.5 & medium clouds & 0.8 & off-season closer to summer & 0.66 \\ midday & 0.7 & heavy clouds & 1 & summer & 1 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Description and features values for clusters initial approximations. Figure 8: Flow-chart of the algorithm. According to Table 3, various combinations of cloudiness values, solar altitude angle sine and solar inclination angle are formed to determine the initial approximations of the cluster centers. The number of possible combinations is 43. Since in the range of the solar altitude angle sine close to 0.7 (midday), there are no points with coordinates along the axis \(\delta\) in the range of 0.1-0.33 (winter-off-season closer to winter), combinations with such values are not included in the final set of cluster centers' initial approximations. A total set of 56 different combinations is formed. Figure 9a,b illustrate the location of 6076 observations (blue markers) and 56 initial approximations of cluster centers (black markers) in a three-dimensional feature space \(\sin\alpha-cc-\delta\).