## 3 Anode Effect Prediction
### Data Labeling and Dealing with Imbalance  
After feature generation and the resultant determination of the smallest time step between two samples, it was possible to label the data. An example of the data labeling is shown in Figure 5. The timestamp of the AE start is available with a resolution of seconds. All samples where the timedelta until AE start is less than 1 min is labeled as 0. All samples where the timedelta until AE start is at least 1 min up to 2 min is labeled as 1. This procedure continues until the label 10 is generated. The timestamp of AE termination is also available with a resolution of seconds and is rounded up to the next full minute. All samples that are between the AE start and the modified AE end get the label AE. Finally all other samples are labeled as normal. To create the final dataset only samples with the label 1 (minority class) and normal (majority class) are kept. This ensures that the lead time is at least 1 min.  
Figure 4: Features used as input for machine learning model.  
Figure 5: Example of data labeling.  
Regarding samples with the label 1 a prevalence of 0.0035% for train dataset (0.0034% test dataset) was calculated. This means that there is a severe imbalance between normal state and AE state. Another common term to describe an imbalance is the imbalance ratio (IR). It is defined as the number of negative class samples divided by the number of positive class samples [23]. For the train and test dataset IR is about 29,000. [PERSON] et al. [23] state that the most well-known repository for imbalanced datasets is the knowledge extraction based on evolutionary learning (KEEL) repository. Looking at the IR value from these datasets one can observe that it is not typically larger than 100. [PERSON] [24] criticises that there is a lack of studies on the classification of extremely imbalanced datasets. He states in real-life applications such as fraud detection or cheminformatics the imbalance ratio would be ranging from 1000 to 5000. According to that, it is important to note that the dataset in this paper belongs to the group of extremely imbalanced datasets. In literature there are three main techniques to deal with imbalance in classification. First it is possible to upsample the minority class, second downsample the majority class or third using cost-sensitive machine learning algorithms [25]. In this paper a combination of the last two techniques is used. In the first step the majority class is downsampled. For this purpose the imbalanced-learn package (version 0.7.0) by [PERSON] et al. [26] is used. The aim is to resize the training dataset, which contains over 12 million samples, so that the following training step does not take time in the order of days. In contrast to cleaning undersampling techniques, controlled undersampling techniques allow to specify the class ratios. In this paper RandomUndersampler and NearMiss are used. While RandomUndersampler randomly selects a subset of data, NearMiss implements three different types of heuristic--NearMiss-1 selects majority class examples with minimum average distance to n closest minority class examples. NearMiss-2 selects majority class examples with minimum average distance to n furthest minority class examples. At the last NearMiss-3 selects majority class examples with minimum distance to each minority class example [25; 26].