## 2 Materials and Methods
### Parameter Configuration  
The rolling time window value is determined through the model training prediction of the SRU. The SRU parameters are set as follows: the learn rate is 0.001, the hidden size is 64, the batch size is 128, the epochs is 500, the optimizer is adam, the loss function is the MAE, the output size is 1, and the number of layers is 1.  
KNN is used to process outliers on the data, the SRU training prediction is verified for the outlier processing effect, and the KNN parameters are optimized by using the HPO algorithm, which requires setting the relevant parameters of the HPO and the SRU model. After many experiments, the relevant parameters of the HPO are set as follows: nPop is 60, T is 30, lb is 5, ub is 35, and dim is 2. Finally the KNN was able to perform the optimal parameter search within the range of n_neighbors [5; 6; 7; 8; 9; 10; 11; 12; 13; 14; 15; 16; 17; 18; 19; 20; 21; 22; 23; 24; 25; 26; 27; 28; 29; 30; 31; 32; 33; 34; 35] and contamination [0.05-0.15]. The SRU parameters are as follows: the learn rate is 0.001, the hidden size is 64, the batch size is 128, the number of epochs is 500, the optimizer is adam, the loss function is the MSE, the output size is 1, and the number of layers is 1.  
The SRU model is used for training and prediction, and the HPO algorithm is used to optimize the parameters of the SRU model, which requires setting a reasonable number of HPO parameters to search for the optimal parameters of the SRU. After many experiments, the relevant parameters of the HPO are set as follows: nPop is 60, T is 60, lb is 5, ub is 15, dim is 4. And the final SRU is searched for the optimal parameters within the range of the learn rate [0.001-0.01], batch size [\(2^{3}-2^{8}\)], hidden size [\(2^{3}-2^{7}\)], and number of layers [1; 2; 3; 4; 5].  
In order to emphasize the effectiveness of the proposed HPO-KNN-SRU model, this study constructed various models such as SVR, LSTM, the TCN, and the SRU. The performance of SVR, LSTM, the TCN, the SRU and the HPO-KNN-SRU methods was evaluated to highlight the performance of the stand-alone HPO-KNN-SRU model. By introducing the HPO-KNN-SRU (only optimizing the KNN), model ablation experiments were carried out, and the experimental results of the HPO-KNN-SRU proved the effectiveness of the HPO algorithm in searching for the optimal parameters of the SRU. To further verify the effectiveness of the KNN in processing outliers in photovoltaic power data, we constructed the KNN-SRU and KNN-SVR models based on the KNN to conduct ablation experiments and compared them with the the SRU and SVR models. Simultaneously, by comparing the experimental results of the KNN-SRU and HPO-KNN-SRU (only optimizing the KNN), it is proved that the HPO algorithm is effective in searching for the optimal parameters of the KNN. Due to the use of a new dataset, grid search optimization was performed on each model parameter based on previous experience, and the final parameters were determined as follows:  
* SVR: c = 10, gamma = 0.01, kernel = rbf
* LSTM: learn rate = 0.005, hidden size = 32, batch size = 128, number of layers = 1, optimizer = adam, loss function = MSE* TCN: channels = [32; 64; 8], kernel sizes = 3, dilation = [1, 2, 4], optimizer = adam, loss function = MSE
* SRU: learn rate = 0.001, hidden size = 64, batch size = 64, number of layers = 1, optimizer = adam, loss function = MSE  
For the KNN-SRU and KNN-SVR, the parameters for the KNN were determined through multiple experiments as follows: n_neighbors = 10, contamination = 0.1.  
This paper records the starting time before starting, and then uses the current time minus the starting time as the prediction time at the end of prediction. In order to make the time recording more accurate, each model in this article uses the average prediction time of three experiments as the final prediction time, and while each model is running, the device is not running any other tasks.