# Improved Anomaly Detection by Using the Attention-Based Isolation Forest
## 5 Numerical Experiments
### Real Datasets  
The first real dataset that was used in the numerical experiments is called the Credit dataset ([[https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud](https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud)]([https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud](https://www.kaggle.com/datasets/mlg-ulb/creditcardfraud)), (accessed on 1 November 2022)). According to the dataset's description, it contains transactions made by credit cards in September 2013 by European cardholders, with 492 fraud cases out of \(284,807\) transactions. We used only 1500 normal instances and 400 anomalous ones, which were randomly selected from the whole Credit dataset. The second dataset, called the Ionosphere dataset ([[https://www.kaggle.com/datasets/prashant111/ionosphere](https://www.kaggle.com/datasets/prashant111/ionosphere)]([https://www.kaggle.com/datasets/prashant111/ionosphere](https://www.kaggle.com/datasets/prashant111/ionosphere)), (accessed on 1 November 2022)) is a collection of radar returns from the ionosphere. The next dataset is called the Arrhythmia dataset ([[https://www.kaggle.com/code/medahmedkrichen/arrhythmia-classification](https://www.kaggle.com/code/medahmedkrichen/arrhythmia-classification)]([https://www.kaggle.com/code/medahmedkrichen/arrhythmia-classification](https://www.kaggle.com/code/medahmedkrichen/arrhythmia-classification)), (accessed on 1 November 2022)).The smallest classes with numbers of 3, 4, 5, 7, 8, 9, 14, and 15 were combined to form outliers in the Arrhythmia dataset. The Mulcross dataset ([[https://github.com/dple/Datasets](https://github.com/dple/Datasets)]([https://github.com/dple/Datasets](https://github.com/dple/Datasets)), (accessed on 1 November 2022)) was generated from a multivariate normal distribution with two dense anomaly clusters. We used 1800 normal and 400 anomalous instances. The Http dataset ([[https://github.com/dple/Datasets](https://github.com/dple/Datasets)]([https://github.com/dple/Datasets](https://github.com/dple/Datasets)), (accessed on 1 November 2022)) was used in [17] to study iForest. The Pima dataset ([[https://github.com/dple/Datasets](https://github.com/dple/Datasets)]([https://github.com/dple/Datasets](https://github.com/dple/Datasets)), (accessed on 1 November 2022)) aims to predict whether or not a patient has diabetes. The Credit, Mulcross, and Http datasets were reduced to simplify the experiments. The numerical results are shown in Table 7. ABIForest is presented in Table 7 with the hyperparameters \(\epsilon\), \(\tau\), and \(\omega\), as well as the F1-score. iForest is presented with the hyperparameter \(\tau\) and the corresponding F1-score. The hyperparameters leading to the largest F1-score are presented in Table 7. It can be seen from Table 7 that ABIForest provided outstanding results for five of the six datasets. It is also interesting to point out that the optimal values of the hyperparameter \(\epsilon\) for the Ionosphere and Mulcross datasets were equal to 0. This implies that the attention weights were entirely determined by the softmax operation (see (17)). A contrary case was when \(\epsilon_{opt}=1\). In this case, the softmax operations and their parameter \(\omega\) were not used, and the attention weights were entirely determined by the parameters \(\mathbf{w}\), which could be regarded as the weights of trees. \begin{table}
\begin{tabular}{l c c c c} \hline \hline
**The Circle Dataset** & & & & \\ \hline \(n\) & 50 & 200 & 800 & 1200 \\ \hline iForest & 0.867 & \(\mathbf{0.977}\) & 0.945 & 0.920 \\ \hline ABIForest & 0.916 & 0.975 & \(\mathbf{0.986}\) & 0.978 \\ \hline The Normal dataset & & & & \\ \hline \(n\) & 50 & 150 & 350 & 550 \\ \hline iForest & 0.266 & \(\mathbf{0.506}\) & 0.450 & 0.253 \\ \hline ABIForest & 0.264 & \(\mathbf{0.512}\) & 0.326 & 0.413 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: F1-score measures of the original iForest and ABIForest as functions of the training data number \(n\) for the Circle and Normal datasets.