A direct prediction method for wind power ramp events considering the class imbalanced problem

Predicting wind power ramp events directly based on the historical ramp event time series has drawn increasing attention recently. But the class imbalance problem of the ramp event time series significantly affects the prediction accuracy of ramp events. In the present study, a layer oversampling (LOS) method is proposed considering the relation characteristics of wind power amplitudes and the occurrence frequency of wind power ramp events. Meanwhile, a hybrid sampling method of error bootstrap‐LOS (EB‐LOS) is proposed by combining LOS with the EB oversampling method. After balancing the samples of the ramp and nonramp events by using different sampling methods, the backpropagation neural network (BPNN), and the long short‐term memory (LSTM) methods are employed to directly predict ramp events based on historical data collected from eight wind farms. Comparison results proved that the proposed EB‐LOS method achieves the best prediction performance with an average recall of 0.8196 when using the BPNN model to directly predict ramp events. The best prediction performance of the EB‐LOS method is also proved by using the LSTM model to directly predict ramp events.


| INTRODUCTION
Wind power is expected to be one of the important energy resources to achieve the carbon-neutral target in China. However, sharp increases (ramp up) or decreases (ramp down) in wind power during short periods have a significant impact on the power system stability and supply-demand balance. These fluctuations are called wind power ramp events. 1,2 Wind power ramp events have significant impacts and harm on the safety, stability, dispatching planning, and real-time control of the power system. For example, a sudden wind power ramp event that occurred in 2008 in Texas caused a power system disconnection accident and resulted in a large-scale power outage. 3 In February 2011, the local wind turbines are frozen due to the winter storm froze, resulting in a power cut of 1650 million kilowatts, and an increase in the electricity prices of nearly 100 times. 4 Similar wind power ramp events have also been reported in Europe, China, and other countries. 5 Conversely, ramp-up events must be compensated by ramping down generation units, shutting them off, or in some instances curtailing the high-producing wind. As a result, wind power ramp events have generated significant attention worldwide. 5

| Definition of wind power ramp events
Generally speaking, a ramp event represents a large and sharp variation in wind power. To identify a ramp event, most studies consider a ramp binary classification 6 : where I t is the indicator function, S t is the certain criterion function, and S 0 is the threshold value. Generally, S t is usually calculated as 7,8 where P t t ( + Δ ) and P t ( ) are wind power at time t t + Δ and tand t Δ is the time interval. Besides the commonly used definitions, some studies identified ramp events based on other approaches. Wan et al. 9 identified wind power ramp events by comprehensively considering the information on the source, grid, and load. Gallego et al. 10 used the Haar wavelet coefficient to identify wind power ramp events.

| Wind power ramp event prediction
Wind power ramp event prediction is an effective approach to mitigate their impacts on the power system. Wind power ramp event prediction methods can be divided into indirect prediction and direct prediction. 4,11 The indirect prediction first predicts wind power time series. Then based on the definition of ramp events, the algorithm is designed to scan the predicted wind power time series and extract future wind power ramp events. While in the direct prediction method, historical wind power ramp event time series are firstly obtained based on historical wind power time series and the definition of ramp events. Then, the obtained ramp event time series are used to train the prediction model of ramp events. Finally, future wind power ramp events are directly predicted by using the trained predictor and historical ramp event time series. 12 Many studies have focused on the indirect prediction of wind power ramp events. Das proposed a model to investigate the relationship between wind power ramp events and the variability of wind power. Then, the actual distribution of the wind power ramp events is estimated according to the model. 13 Zhou et al. 14 proposed a hybrid prediction model based on the semisupervised generative adversarial network to predict wind power and its ramp events. Han et al. used the optimized swinging gate algorithm and convolutional neural network to obtain the coupling relationship features between wind power and ramp features. Then, the long short-term memory (LSTM) model is utilized to learn the time-series relationship of the data. Wind power ramp events are identified based on the obtained model and forecast wind power. 15 Cao et al. 16 predicted the probability distribution of wind power by using the Gaussian mixture model. Then, the future occurrence probability of wind power ramp events is estimated by using the Kullback-Leibler divergence method. Ouyang et al. 17 corrected wind power prediction residual by combining the Markov chain and the autoregression model. Then, wind power ramp events are detected by an improved swinging door algorithm. Zucatelli et al. 18 combined the wavelet decomposition and deep learning methods to forecast wind speed. After this computational procedure, wind power ramp events were identified based on the prediction results of wind power. Dhiman et al. 19 proposed a hybrid model by employing wavelet decomposition transform in tandem with a convolutional neural network and twin support vector machines to predict wind power. Then, ramp events were detected based on the precited wind power. Okada et al. 20 utilized principal component analysis to optimize numerical weather prediction (NWP) methods to predict wind speed and power. Ramp events were indirectly predicted based on the results of NWP. Cao et al. 21 employed an image-based similarity search strategy to build a link between the wind speed forecasts and the wind power ramp events prediction. Zheng et al. 22 decomposed the wind power series into several intrinsic mode function components and one residual component by using the variational modal decomposition method. The extreme learning machine and Bayesian optimized LSTM network were used to predict each individual component. The final offshore wind power is obtained by superimposing and integrating the prediction results of each component. Offshore wind power ramp event is then predicted and characterized by its definition and wind power forecasts.
A limitation of the indirect prediction is that the fluctuation in wind power forecasts naturally contains errors in both the magnitude and occurrence time. Previous studies have reported that the predicted fluctuation in wind power is smaller than the actual fluctuation. 23,24 These errors significantly affect the prediction accuracy of wind power ramp events. 11 While the direct prediction is independent of predicting wind power. The prediction errors of wind power are not involved in predicting ramp events. Direct prediction is expected to facilitate early warning of the possible risk of ramp events 11 and have a higher prediction accuracy. 25 Zheng and Kusiak 12 defined the power ramp rate as the change rate of wind power within 10 min. Then, the ramp rates are calculated based on the wind power time series. Finally, the wind farm power ramp rates are predicted based on historical ramp rates and the data-mining approach. Zareipour et al. 26 classified the wind power ramp events into different classes. Then, the class of future ramp events is predicted by using the support vector machine method and historical classes. However, the forecast accuracy of ramp events is below expectation. This is because the predictor of ramp events is directly trained using the original wind power ramp event time series. But compared with nonramp events, ramp events are very rare. The proportion of nonramp events is much greater than ramp events, which is known as the class imbalance problem. As a result, the predictor trained by using the original wind power ramp event time series tends to predict nonramp events instead of ramp events. The class imbalance problem significantly results in low prediction accuracy of wind power ramp events. 27 Addressing the class imbalance problem of the wind power ramp event time series has been a primary issue faced by the direct prediction of wind power ramp events. Takahashi et al. 27 have proved that mitigating the class imbalance problem is effective to improve the ramp events prediction accuracy. Fujimoto et al. 11 proposed the error bootstrap oversampling (EBOS) method focused on errors in wind power prediction results used for ramp events prediction. Meanwhile, random undersampling (RUS), random oversampling (ROS), and synthetic minority oversampling (SMOTE) methods are used to address the class imbalance problem when directly predicting wind power ramp events. The results proved that the RUS + EBOS method drastically improved the ramp events prediction accuracy. Dorado-Moreno et al. 28 divided the wind power ramp events into three classes of negativeramp, positive, and nonramp. The SMOTE method is applied to alleviate the high degree of unbalance in the data set. Then, the ramp events are predicted by using the reservoir computing model. Cornejo-Bueno et al. 29 applied the SMOTE method to process the unbalanced data of ramp events as well. Then, the extreme learning machine method is used to predict the classes of ramp events.

| Novelty, objective, and structure of the study
These above-mentioned studies successfully improved the prediction accuracy by addressing the class imbalanced problem between ramp events and nonramp events. When analyzing the historical wind power ramp events, we found that the frequency of ramp events highly depends on wind power amplitudes. Based on the relation characteristics between wind power amplitudes and ramp events, the present study proposes a layer oversampling (LOS) method to address the class imbalance problem. To the best of the authors' knowledge, addressing the class imbalance problem based on the characteristics of historical ramp events has not been explored in previous studies. Furthermore, a hybrid oversampling method is proposed by combining LOS with EBOS methods. Then, wind power ramp events are directly predicted based on the proposed methods and historical wind power collected from eight wind farms.
The rest of the paper is organized as follows: Section 2 introduces the data and methods used in the study. Section 3 shows the experiment results. Section 4 concludes the study.

| Data
In the study, the experiments are conducted based on wind power time series during a year collected from eight wind farms. The sampling resolution is 15 min. The rated installed capacity ranges between 150 and 280 MW. The wind farms are located in Ningxia (3 wind farms), Inner Mongolia (3 wind farms), Jilin (1 wind farm), and Heilongjiang (1 wind farm) provinces in China. Ningxia, Inner Mongolia, Jilin, and Heilongjiang are respectively in northwestern, northern, and northeastern China, which are important renewable energy bases.

RUS
The RUS method randomly removes the samples from the majority class until the different classes have the same samples. The schematic diagram of RUS is shown in Figure 1.

ROS
The ROS method resamples the samples involved in the minority class until different classes have the same samples. The schematic diagram of ROS is shown in Figure 2.

SMOTE
SMOTE is an improved approach based on ROS. SMOTE introduces synthetic samples along the segments joining it with its n nearest neighbors in the minority class. Each synthetic pattern is derived by obtaining the difference between both patterns and multiplying this difference by a random number between 0 and 1 (random interpolation). The schematic diagram of SMOTE is shown in Figure 3.

EBOS
EBOS approach is proposed by Fujimoto et al. 11 EBOS approach focused on the errors in wind power prediction results used for the ramp event prediction. First, the error sequence of wind power prediction is calculated based on historical data. The sampling weight is defined by the Laplacian kernel function and the forecast errors. According to the weight, an error sequence that has a similar predicted power at the target horizon is selected. Then a plausible synthetic wind power prediction sequence is obtained by adding the selected error sequence to the observations. The firstorder difference of the plausible synthetic wind power prediction sequence is calculated. The new samples of ramp events are extracted based on the first-order difference. Thus, the class imbalance problem between ramp events and nonramp events is mitigated. The detailed algorithm of EBOS can be found in Fujimoto et al. 11 Predicting wind power is involved in both the indirect prediction method and the EBOS method, but their aims are significantly different. In the indirect prediction method, the extraction algorithm is applied to the predicted wind power sequence to detect future ramp events. In the EBOS method, the relationship between the predicted wind power and corresponding prediction errors is analyzed and used to generate synthetic errors. New plausible synthetic wind power prediction sequences are obtained based on the synthetic errors. By calculating the first-order differences of the synthetic wind power prediction sequences, new ramp events are obtained. The aforementioned process is repeated until the samples of nonramp events and ramp events are the same. Forecasting wind power aims to generate new samples of ramp events. The wind power ramp event predictor is trained using these samples. The future ramp events are directly predicted based on the trained predictor and historical samples.

| LOS method
1. Relation characteristics between wind power ramp events and wind power amplitudes In the present study, a wind power ramp event is defined as where P t t P t ( + Δ ) − ( ) is the first-order difference in wind power, t Δ is the time interval, and P th is the given threshold. In the study, P th is given as 25 where P R is the rated installed capacity. Based on the definition, the sequence of wind power ramp events can be obtained as After obtaining the sequence of wind power ramp events, the relation characteristics between the occurrence frequency of wind power ramp events and wind power  amplitudes are investigated. The results are shown in Figure 4. When the wind power is smaller than half of the rated installed capacity, there is a strong linear relationship between the occurrence frequency of wind power ramp events and wind power amplitudes for most wind farms. The greater the wind power, the higher the occurrence frequency of the ramp events. But when the wind power exceeds half of the rated installed capacity, the occurrence frequency of ramp events is almost independent of wind power amplitudes in most studied wind farms. To further verify the results shown in Figure 4, the Pearson's correlation coefficient (PCC) between the occurrence frequency of wind power ramp events and wind power amplitudes is calculated, as shown in Table 1. PCC ranges between 0.72 and 0.94 in the scenario of   P P 0 50% R , implying a strong positive correlation. While in the range of   P P P 50% R R , the absolute value of PCC is smaller than 0.31 in most wind farms, indicating a weak even negligible correlation. Meanwhile, PCC is negative in most wind farms when   P P P 50% R R . This result reveals that the frequency of ramp events tends to decrease with the increase of wind power amplitude. Figure 4 and Table 1 prove that the distribution of wind power ramp events is uneven under different wind power amplitudes. So, the present study tries to address the class imbalance problem considering the relation characteristics between wind power ramp events and wind power amplitudes.

Definition of the LOS method
For a wind farm with the rated installed capacity of P R , the wind power output is averagely divided into N layers. The lower and upper borders of the ith layer are i P N ( − 1) / R and i P N ( × )/ R . Then, wind power output P t ( ) belongs to the ith layer if After obtaining the sequence of wind power ramp events, the sample numbers of ramp events and nonramp events contained in each layer are counted, which are noted as G i and Q i , respectively. Then, the duplication rate ε i of the sample of ramp events in each layer is defined as The procedure of the LOS method is: (1) The time series of wind power ramp events P t ( ) R is calculated according to Equations (5)-(7).
(2) The layers of wind power are determined according to P R and N .
(3) P R (t) is assigned to its corresponding layer according to wind power amplitude. (4) In each layer, ramp events are duplicated according to ε i until the samples of ramp events and nonramp events are the same. Figure 5 illustrates the schematic diagram of the LOS method. By giving different duplication rates in each layer, the relation characteristics between the occurrence frequency of wind power ramp events and wind power amplitudes are considered to address the class imbalance problem.

| A hybrid oversampling method (EB-LOS) by combining EBOS and LOS methods
Fujimoto et al. 11 proposed the EBOS method by considering wind power prediction errors. Experiment results have proved that using the EBOS method has a higher prediction accuracy of ramp events than using the RUS, ROS, and SMOTE methods. In view of the advantage of the EBOS method, a hybrid oversampling method by combining EBOS and LOS is proposed in the present study. The first three processes of the EB-LOS method are the same as that of the LOS method. In the fourth process, the new samples of ramp events are added by the EBOS method in each layer instead of using ε i to duplicate the existing samples.

| Experimental setup
The length of the wind power time series collected from eight wind farms is 1 year with a resolution of 15 min. The wind power ramp event time series are first obtained based on Equations (5)- (7). t Δ is selected as 15 min in the study. In the study, the wind power is divided into 100 layers in the study, that is, N = 100. Each ramp event is assigned to its corresponding layer. Then, the samples of ramp events are duplicated using LOS and EB-LOS methods, respectively. After addressing the class imbalance problem, prediction methods are used to directly predict wind power ramp events.  To evaluate the prediction performance, the metrics of accuracy, precision, and recall are defined as

Accuracy TP TN TP FP FN TN
where TP TF FN , , , and FP are obtained according to the confusion matrix in Table 2.
The metrics of accuracy, precision, and recall range between 0 and 1. Accuracy means what fraction of ramp and nonramp events are correctly predicted. Precision represents what fraction of the predicted ramp events really occurs. Recall means what fraction of observed ramp events are correctly predicted.
In the EB-LOS method, the BPNN model is used to predict wind power. During the wind power prediction process, the wind power time series in the previous 24 h are used to predict wind power 15 min ahead. The first 8 months of wind power is used to train the predictor. The last 4 months of data is used to test and obtain the prediction errors of wind power.

| Result analysis
The BPNN model is first used to directly predict wind power ramp events based on the proposed sampling methods. Table 3 shows the prediction accuracy based on different sampling methods. As shown in Table 3, the prediction accuracy is usually greater than 0.8 even if no sampling method is employed. This is because the majority of samples of the wind power ramp event time series are nonramp events. The prediction accuracy is still high even if all the predicted output is nonramp events. But such a predictor is not expected for the present study since we focused on the minority samples, that is, ramp events.
The prediction accuracy is further improved by addressing the class imbalance problem of ramp event time series using sampling methods. This is because more ramp events are correctly predicted than the OR method. But only using prediction accuracy still cannot compare the prediction ability of ramp events, so the precision and recall are further calculated, as shown in Tables 4 and 5.  F I G U R E 5 Schematic diagram of the layer oversampling (LOS) method. The blue circle represents the minority sample. The blue square represents the majority sample. Wind power is divided into three layers in the figure.
T A B L E 2 Confusion matrix.

Ramp prediction
Ramp observation As shown in Table 4, the prediction precision of the OR method is generally smaller than 0.25 in most wind farms, which means that the proportion of predicted ramp events that really occur is smaller than 0.25. Addressing the class imbalance problem significantly raises the proportion. Precision is usually greater than 0.5 in most cases, implying that at least 50% of the predicted ramp events really occur. The proposed LOS and EB-LOS methods show the highest prediction precision in wind farms 1, 2, and 3. The EBOS and RUS methods show the highest precision in wind farms 4 and 8, respectively. While in wind farms 5, 6, and 7, the SMOTE method shows the highest precision.
As shown in Table 5, the prediction recall of the OR method is smaller than 0.20 in most cases, that is, only less than 20% of the observed ramp events are correctly predicted. The proposed LOS method shows the highest recall in wind farm 3. In the rest 7 wind farms, the EB-LOS method has the highest recall. More than 75% of the observed ramp events are correctly predicted by using the EB-LOS method. Figure 6 shows the plot of average precision and recall between different sampling methods using the BPNN model. Obviously, the EB-LOS method achieves the highest prediction recall of 0.8196 and retains higher prediction precision of 0.6287.
Precision and recall evaluate different abilities of the predictor. Precision usually represents the predictor's ability to avoid false alarms of ramp events. While recall evaluates the predictor's ability to correctly predict all the ramp events that we are concerned about. Precision and recall generally conflict with each other. In general, increasing the precision of a predictor will decrease its recall and vice versa. As discussed in the Introduction, wind power ramp events have significant impacts and harm on the safety, stability, dispatching planning, and real-time control of the power system. So, for the power system, the ramp events that are not correctly predicted would result in much greater costs than that caused by false alarms of ramp events. In other words, the power system would want a higher recall of the ramp events predictor. So, the proposed EB-LOS method results in better prediction performance of ramp events than other sampling methods. The prediction recall of the BPNN model is increased by 17.4%, 6.6%, 6.8%, 6.5%, and 6.6% using the EB-LOS method compared with the RUS, ROS, SMOTE, EBOS, and LOS methods.
To further verify the effectiveness of the proposed methods, the BPNN model is replaced by the LSTM model and conducts the same experiment as the previous one. Figure 7 shows the plot of average precision and recall between different sampling methods using the LSTM model. The EB-LOS method still achieves the highest prediction recall of 0.7882 and retains higher prediction precision of 0.5853. The prediction recall of the LSTM model is increased by 12.9%, 6.2%, 7.0%, 8.5%, and 3.3% using the EB-LOS method compared with the RUS, ROS, SMOTE, EBOS, and LOS methods.
F I G U R E 6 Comparison of the average precision and recall for ramp events prediction between different sampling methods by using the backpropagation neural network model. EB-LOS, error bootstrap layer oversampling; EBOS, error bootstrap oversampling; LOS, layer oversampling; ROS, random oversampling; RUS, random undersampling; SMOTE, synthetic minority oversampling.
F I G U R E 7 Comparison of the average precision and recall for ramp events prediction between different sampling methods by using the Llong short-term memory model. EB-LOS, error bootstrap layer oversampling; EBOS, error bootstrap oversampling; LOS, layer oversampling; ROS, random oversampling; RUS, random undersampling; SMOTE, synthetic minority oversampling.
In the present study, we focused on directly predicting wind power ramp events based on the historical sequence of ramp events. Practical analysis revealed that the occurrence frequency of wind power ramp events is affected by wind power amplitudes. Based on the relation characteristics between wind power ramp events and wind power amplitudes, the LOS method is proposed to address the class imbalance problem between ramp events and nonramp events in the present study. Wind power is divided into different layers. Then, the samples of ramp events are duplicated according to the defined duplication rate for each layer. Furthermore, a hybrid EB-LOS oversampling method is proposed by considering both the LOS method and the wind power forecast errors by using the EBOS method. After addressing the class imbalance problem of wind power ramp event time series using different sampling methods, the BPNN and LSTM are used to directly predict ramp events. Results proved the validity of the proposed LOS method. But only using the LOS method did not show the best prediction performance for all the cases. The EB-LOS method achieves the highest recall and retains higher precision for most cases. The prediction recall of the BPNN predictor for ramp events is increased by 17.4%, 6.6%, 6.8%, 6.5%, and 6.6% using the EB-LOS method compared with the RUS, ROS, SMOTE, EBOS, and LOS methods. In the LSTM model, the increments in the recall are 12.9%, 6.2%, 7.0%, 8.5%, and 3.3%, respectively.
Although the present study has improved the prediction performance by addressing the class imbalance problem taking into account the relationship characteristic of wind power amplitudes and wind power ramp events, some issues need to be further explored in future studies: 1. The practicability of the proposed method in the actual power system should be considered. On the one hand, the prediction horizon in the present is 15 min. It is believed that ramp events prediction within a longer prediction horizon would be more helpful for the power system. On the other hand, the present study only forecasts whether the wind power ramp event would occur or not. But for the power system, predicting the detailed information of ramp events (i.e., ramp amplitude, ramp direction, duration, and occurrence time) contribute to mitigating ramp events more effectively. So, predicting the detailed information of ramp events within a longer prediction horizon is our future work. 2. The hybrid EB-LOS method has a higher prediction performance by taking into account the prediction information of wind power. Within the increasing prediction horizon, only using the data-driven method to predict wind power would result in larger deviations. Applying the EB-LOS method based on the NWP model would obtain higher prediction performance compared with only using the data-driven models, which is our future study.