Anomaly detection (AD) Chandola et al. (2009) is a classical data mining task which aims at detecting data instances that significantly deviate from the majority. Nowadays, with the rapid development of information technology, AD is playing a more and more important role in domains like cybersecurity, healthcare, and finance Nguyen and Reddi (2019); Yu et al. (2021a); Charpentier et al. (2021). In this work, we focus on a specific type of AD, namely tabular semi-supervised AD, where the training dataset is composed of a small labeled dataset and a large unlabeled dataset. We think this kind of task is of great importance in real application scenarios since labeled data is more difficult to obtain than unlabeled data due to privacy, security, and other problemsZhu et al. (2019).
In classical semi-supervised AD tasks, both training and testing sets share the same distribution, which means labeled anomalies in training set contains all classes of anomalies in testing set. However, in real world scenarios, it is very common for the incoming anomalies come from previously unseen distributions, which requires an AD method to have stronger ability in mining unlabeled dataset, e.g., it needs to find unknown anomaly classes in unlabeled dataset to make correct judgments.
We highlight several challenges that need to be addressed in the tabular semi-supervised AD domain:
Utilize known anomalies to detect unknown anomalies: Anomalies from real-word datasets are sometimes diversified Pang et al. (2021b) and incoming new data may include unknown anomalies Villa-Pérez et al. (2021). Semi-supervised AD methods need to leverage known anomalies to explore contaminated unlabeled data efficiently and effectively to find potential unlabeled unknown anomalies.
Efficiently utilize limited labeled anomalies to solve exploration-exploitation dilemma: In real-world datasets, anomalies are very rare. On top of exploring unlabeled data, semi-supervised AD methods need to exploit labeled known anomalies effectively.
Reinforcement learning (RL) Kaelbling et al. (1996)
is a machine learning paradigm in which an agent learns an optimal policy through interacting with the environment. Since its birth, RL has attracted lots of attention and shown its effectiveness in many tasks. In recent years, deep RL (DRL)Arulkumaran et al. (2017)
takes a step further, which combines RL with deep learningLeCun et al. (2015) and achieves prominent performance in many fields such as games and automatic driving Mnih et al. (2015, 2013); Sallab et al. (2017); Silver et al. (2017).
However, there is still little research on the application of RL to AD. A recently purposed RL-based AD method called DPLAN Pang et al. (2021b) uses an RL setting to explore unlabeled samples based on labeled anomalies. Experiments in the original paper of DPLAN show that it is a successful trial of applying RL to the AD domain. However, we argue that the distance-based search of DPLAN is easy to fall into local optima. In addition, through reproduction we find that it faces problems like overfitting and weak robustness to the contamination of unlabeled dataset.
Regardless of the disadvantages of DPLAN, we still believe that RL will become a powerful tool for AD with a carefully designed environment, since it has a strong advantage in balancing short-term reward (e.g., the reward of the correct judgment of the current data) and long-term reward (e.g., the reward of finding anomalies from unlabeled data), which is also known as balancing between exploitation and exploration. In this paper, we purpose a method called DADS which applies RL to AD effectively. DADS draws the idea of ensemble and has an environment with hierarchical anomaly search mechanism. We conducted comprehensive experiments which prove the capability of DADS in tackling the above mentioned challenges of semi-supervised AD.
The main contributions of this work can be summarized as improvements in scenarios where testing set contains unknown anomaly classes. With the help of RL, DADS integrates the search and refinement of unlabeled dataset into one model. Thus, the issues of contamination and unknown anomaly search existing in most AD methods are well solved.
Background and Related Work
In this section, we first introduce the basic of reinforcement learning (RL) and anomaly detection (AD), then present some classical or latest semi-supervised tabular AD methods.
In RL, the agent is asked to interact with the environment to deal with a sequential decision-making problem. At each time step , the agent is capable of sensing the state from the environment and then selects an action according to policy , given the state . The chosen action is passed to the environment and executed, which causes a transition to a new state and a scalar reward . The interaction continues until the task terminates. The objective of RL is to train such an agent to maximize the expected discounted cumulative rewards (a.k.a. return) , where is the discount factor.
The standard RL can be formalized as a Markov decision process (MDP). It can be defined as a 4-tuple, where denotes state space; denotes action space; denotes reward function ; and denotes transition function , . The whole process can be expressed as a trajectory:
, which obeys an implicit probability distribution determined by transition dynamics and policy: . The optimization decision problem can be formalized as:
where is the sum of discounted rewards.
Deep Reinforcement Learning
Deep reinforcement learning (DRL) refers to algorithms that combine RL with deep learning. According to the difference in target network, it can be divided into three categories: value-based, policy-based, and actor-critic algorithms.
Value-based methods use the estimated Q-value to select action. DQNMnih et al. (2013, 2015)
is a classical value-based method. It combines deep learning with Q-learning, and uses a neural network to estimate Q-value. Experiments on Atari show that it can achieve human-level performance, which is a great success. After that, there are many works trying to make improvements, including double DQNMnih et al. (2016), dueling DQN Wang et al. (2016), etc.
Policy-based methods directly model the relationship between state and optimal action. REINFORCE Williams (1992)
is a representative of this category, which uses the Monte-Carlo method to sample trajectories and update parameters. Improved methods include adding a baseline to reduce variance.
Actor-critic methods combine the above two categories. They use actor network and critic network to learn policy function and value function respectively, which can effectively reduce variance and speedup training. Actor-critic Konda and Tsitsiklis (1999) is the most basic method, and by adding baseline we can get the A2C method. A3C Mnih et al. (2016) applies parallel training on the basis of A2C. TRPO Schulman et al. (2015) introduces importance sampling and trust domain constraint in policy update. PPO Schulman et al. (2017) substitutes KL-divergence constraint in TRPO with clipping, which effectively improves its performance. The soft actor-critic (SAC) Haarnoja et al. (2018) method effectively improves the robustness of the algorithm by introducing entropy regularization and dueling Q-network. In this paper, we use SAC as the RL algorithm.
Given a training dataset , AD aims at learning a feature representation mapping function or an anomaly scoring function in a way that anomalies can be easily differentiated in the subspace of or , where denotes representation space. Since AD focuses on rare and irregular events, it faces many challenges including unknownness of anomalies, class imbalance, various types of anomalies, etc Pang et al. (2021a). According to the amount of known data, AD can be divided into three categories: supervised, semi-supervised, and unsupervised Ruff et al. (2021). Unsupervised AD is the most studied category, many works have been done in this area, including Isolation Forest Liu et al. (2008), Histogram-based Outlier Score Goldstein and Dengel (2012), One-Class SVM Schölkopf et al. (2001), NCAE Yu et al. (2021b), etc. Most supervised AD methods are classification methods Ruff et al. (2021)
including XGBoostChen and Guestrin (2016), VIME Yoon et al. (2020), etc.
Semi-supervised Tabular Anomaly Detection
In this paper, we focus on semi-supervised tabular AD problems, where both unlabeled samples and a small portion of the labeled anomalies and labeled normal samples are available during training Ruff et al. (2021). Generally, semi-supervised AD methods can be classified into supervised-based and unsupervised-based categories Görnitz et al. (2013).
On top of the supervised learning paradigm, supervised-based semi-supervised AD methods add a bias term to describe the data characterization based on some assumptions, e.g., the cluster assumptionChapelle et al. (2009)
, in the loss functionPang et al. (2019). Their performance relies heavily on the consistency between the distribution of datasets and the assumptions. The mentioned DPLAN is this method.
On the other hand, unsupervised-based semi-supervised AD methods extend the unsupervised AD methods by exploiting labeled data as a regularization term in the loss function Görnitz et al. (2013); Ruff et al. (2019). A recent work Chang et al. (2022) extends the explainable model to the AD method with the Partial IDentification (PID) objective Gopalan et al. (2019), and a differentiable AUC loss is added to incorporate labeled data. These methods also exist problems like weak robustness to data contamination, insufficient exploration of unlabeled data, etc.
In this section, we introduce our method called DADS in details. Before that, we would like to give a formal statement of the task we aim at. Consider a semi-supervised AD scenario, where two datasets are available:
Anomaly dataset : a small dataset containing only anomalies.
Unlabeled dataset : a relatively large dataset containing both abnormal and normal data.
Given the above two datasets for training, our aim is to find an anomaly scoring function , such that , where is abnormal and is normal. In this paper, we simply focus on tabular data.
Algorithm Framework and Key Components
Figure 1 is an illustration of DADS, which is mainly composed of two parts: a SAC-based agent and an anomaly search environment. To apply RL, we must first transform the training dataset into a data flow environment where key components of RL are clearly defined.
State space is the whole training dataset , with each sampled at timestep be a state.
Action space is a continuous space within range , with value corresponding to anomaly score of input data.
Environment has its own inner dataset, and a single piece of data will be sampled as the state in each training step. When receiving the action of the agent, its inner dataset will make adjustments to its inner dataset according to a series of rules and calculate the reward.
Agent takes the current data as input, uses its inner network to calculate the corresponding action (the anomaly score of the input data), and returns it to the environment.
In the design of the agent, we use the RL algorithm SAC, which adds an extra entropy term to the original target of RL, i.e., maximizing the expected cumulative rewards, and thus its objective function becomes: , where is represented as a policy network, is a state-action pair within trajectory generated by policy , is the entropy term which evaluates the uncertainty of policy , and is the trade-off coefficient.
To find the optimal policy, SAC uses to approximate policy function, uses to approximate action-value function, and uses and to estimate state-value function. The way of updating each network is listed in Appendix A. After training, we get . For every single data , is used as anomaly score.
We emphasize that the entropy term of the objective function in SAC is of great help to the anomaly search of DADS, since the agent is encouraged to take different actions and thus discover more possible anomalies. This entropy regularization, together with the sampling function of DADS, contributes to the search mechanism of DADS.
Anomaly Search Environment
The environment design of DADS is divided into the following three parts.
Hierarchical datasets tailored for anomaly search: The training dataset is separated into three parts and multi-stage screening is used to search for possible anomalies.
Ensemble-based sampling function: Ensemble learning is adopted to integrate different unsupervised AD methods.
Reward function for AD: The agent receives a reward combining both supervised and unsupervised rewards.
Hierarchical Datasets Tailored for Anomaly Search
As mentioned before, the training dataset is composed of and . To make the environment more suitable for anomaly search, we divided the whole training dataset into three interconnected datasets: anomaly dataset , temporary dataset , and unlabeled dataset . As is illustrated in Figure 1
, three blue boxes correspond to three inner datasets of the environment. There are two threshold hyperparameters in the environment, respectivelyand . There is two colors in the legend, in which green indicates anomaly score smaller than threshold , and red indicates the opposite. Each line represents the flow between datasets, the text beside the line is the reward and other information of this flow, and the color of the text is the action of the agent. For example, the leftmost arrow means if current data is sampled from dataset , and the agent gives an anomaly score smaller than threshold, then will be placed back to .
Anomaly dataset contains all data in and other anomaly data searched from . Temporary dataset contains possible anomalies, which need further judgment. Unlabeled dataset contains all remaining data. During training agent will continuously search for possible anomalies from . Before each episode of training, we will initialize as , as , as .
Each time the agent returns an action to the environment, the environment will change the inner dataset to which belongs. Here we give every data an attribute initialized to 0, which measures confidence of classifying as an anomaly. For those sampled from , if , then we move to for further judgement, and set ; if , then we place it back to and set to . For sampled from , if , then we put it back to , meanwhile, ; if , is set to and is put into . Data in are only in but not out, when the confidence of a data in is greater than threshold , we think that it is highly possible of be an anomaly, so we put it into and ask the agent to judge it as an anomaly. For specific value selection of , please refer to Appendix B.
Altogether, each time the environment will pick out a data from an inner dataset (here we stipulate that is taken away from the chosen dataset) after the agent returns action , the environment will place to a new inner dataset according to the following function :
Ensemble-based Sampling Function
The sampling strategy of the environment from its inner dataset
can be summarized as two stages. In the first stage, the environment chooses a certain dataset from three inner datasets according to a predefined probability distribution (e.g. the probabilities of sampling from, , and are , , and , respectively), we denote as the chosen inner dataset. In the second stage, the environment samples data from the dataset selected in the first stage. If the dataset selected in the first stage is in , since the size of these datasets is relatively small, we just use random sampling. If we selected in the first stage, to better explore anomalies in , we learn from the idea of ensemble learning and designed an anomaly-biased sampling strategy.
Specifically, we choose three unsupervised AD algorithms, namely Isolation Forest, Histogram-based Outlier Score, and One-Class SVM. The implementation of Pyod Zhao et al. (2019) is used to calculate unsupervised metrics normalized to range . We choose these three methods for the purpose that they are based on different assumptions, so by combining them together, the sampling strategy is more likely to cover different types of anomalies Ruff et al. (2021). Let the anomaly scoring function of these three algorithms be , and . We also define a random score generator , which gives out scores within the range randomly. Each time the environment will first sample a batch of data from with a certain size, then select one of the above three unsupervised methods (including
) based on a predefined probability distribution (e.g., uniform distribution), we denote the chosen unsupervised method as. We use it to calculate the anomaly score of each data in and at last, choose the one with the highest anomaly score.
To conclude, the sampling function of the environment can be written as:
where is random sampling over the chosen dataset .
Reward Function for Anomaly Detection
The reward function of the environment is designed based on both supervised and unsupervised rewards.
For each data , if it comes from , the agent is asked to make a correct judgment. If the agent correctly classifies , it will get a positive reward, otherwise, it will be punished. This is what we call supervised reward.
If current data comes from or , since there are no supervisory signals, we introduce unsupervised rewards. For sampled from , if and the agent classify as anomaly, then the environment will move to and give a positive reward to encourage the search of possible anomalies; else, reward is 0. For sampled from , to enable the agent to learn data distribution with the help of unsupervised methods, the environment will give an unsupervised reward using isolation forest, which is written as above.
To conclude, the reward of data with regard to action can be written as follows:
The specific value in reward function is designed in the simplest way with no factor multiplied. We think that these parameters can be further optimized for different datasets, however, current setting of reward have already performed well in the experiments.
As stated above, DADS uses a hierarchical search to find anomalies in the unlabeled dataset, and we believe that such a search mechanism is the key to solving the challenges proposed at the beginning of the paper. To be specific, DADS features in the following three aspects.
Strong robustness to contamination: When the agent searches for possible anomalies in unlabeled dataset, it is also cleaning it. In addition, the reward function of DADS is designed in a simple way that it does not include any prior assumption of the unlabeled dataset. Considering the above two points, it can be predicted that DADS will be robust to the contamination of unlabeled dataset.
High search efficiency and accuracy: On one hand, DADS borrows the idea of ensemble learning to improve the accuracy of search. Before a possible anomaly in is finally added into A, it needs to be classified as an anomaly by the agent for times. Notice that the agent is continuously updated, the times judgment is actually an integration of the results of different agents. On the other hand, DADS combines different unsupervised methods in its sampling function to improve search efficiency, while the entropy term of SAC also plays a role in improving it.
Nice balance of exploration and exploitation: With the help of RL, the whole training process of DADS integrates exploring unlabeled dataset and exploiting labeled anomalies in a natural way, which solves the exploration-exploitation dilemma automatically.
This experiments section first gives a brief introduction to the datasets, evaluation metrics, and baseline methods, then gives empirical results on two experiment scenarios.
|Known AD Scenario|
|annthyroid||0.881 0.011||0.824 0.042||0.894 0.025||0.832 0.025||0.739 0.059||0.610 0.028||0.833 0.023||0.9840.010||0.804 0.037|
|cardio||0.973 0.017||0.769 0.098||0.879 0.054||0.967 0.021||0.898 0.047||0.945 0.015||0.919 0.018||0.912 0.076||0.920 0.014|
|satellite||0.822 0.041||0.852 0.032||0.903 0.033||0.845 0.015||0.859 0.015||0.775 0.014||0.786 0.011||0.838 0.044||0.769 0.014|
|satimage2||0.990 0.006||0.813 0.102||0.980 0.018||0.974 0.047||0.973 0.015||0.953 0.023||0.994 0.003||0.969 0.033||0.994 0.003|
|thyroid||0.993 0.007||0.940 0.068||0.953 0.031||0.995 0.006||0.960 0.028||0.901 0.031||0.978 0.007||0.966 0.043||0.974 0.005|
|Average||0.932 0.016||0.839 0.068||0.922 0.032||0.922 0.023||0.886 0.033||0.837 0.022||0.902 0.012||0.934 0.041||0.892 0.015|
|Unknown AD Scenario|
|multiannthyroid||0.759 0.047||0.716 0.055||0.706 0.064||0.712 0.047||0.655 0.047||0.554 0.037||0.651 0.039||0.949 0.043||0.645 0.040|
|multicardio||0.943 0.021||0.670 0.058||0.890 0.03||0.862 0.044||0.873 0.022||0.831 0.023||0.799 0.047||0.826 0.036||0.844 0.018|
|multihar||0.965 0.017||0.628 0.135||0.843 0.139||0.943 0.016||0.889 0.019||0.681 0.148||0.903 0.011||0.944 0.020||0.906 0.012|
|Average||0.889 0.028||0.671 0.082||0.813 0.078||0.839 0.036||0.806 0.029||0.689 0.070||0.784 0.032||0.906 0.033||0.798 0.023|
Datasets and Evaluation Metrics
To make a comprehensive comparison between DADS and other methods, we choose datasets with single anomaly class and datasets with multiple anomaly classes. The former of datasets are used in experiments of scenario , with dimension ranging from to and anomaly percentage ranging from to . Detailed information are in Table S3 of Appendix B. To further compare DADS with baselines, scenario is designed using datasets with multiple anomaly classes, of which size ranging from thousands to tens of thousands and dimension ranging from to . Detailed information are in Table S4 of Appendix B. The last column indicates whether the corresponding class is known or not. If the anomaly class is known, it will appear in both anomaly dataset and unlabeled dataset, else it only exists in unlabeled dataset.
The mentioned datasets serve as base pool of our experiments. We set two adjustable parameters, namely anomalies ratio and contamination ratio. Anomalies ratio corresponds to the ratio of known anomalies to total anomalies (in scenario total anomalies means anomalies of the known anomaly class); contamination ratio corresponds to the percentage of anomalies in unlabeled data.
We stratified split each dataset into training set, validation set and testing set, each accounting for , , and of the total dataset with different random seeds. validation set and testing set are fixed after splitting, so the percentage of each class is consistent with original dataset. Training dataset is manually generated according to the above two adjustable parameters: anomalies ratio and contamination ratio, and, as stated before, it is composed of and . In particular, DADS will search for optimal training episodes on validation set, SSAD and XGBoost will also tune on validation set. Detailed information are in Appendix B.
We select Area Under Receiver Operating Characteristic Curve (AUC-ROC) as the evaluation metric, which measures the area under ROC curve. The reported AUC-ROC are average results over 10 different random seeds.
We select SSAD Görnitz et al. (2013), Deep SAD Ruff et al. (2019), DevNet Pang et al. (2019), XGBoost Chen and Guestrin (2016), STOC Yoon et al. (2021), DPLAN Pang et al. (2021b), and Isolation Forest Liu et al. (2008) as baselines. SSAD and Deep SAD are all based on SVDD Ruff et al. (2018), which use hypersphere to envelop the anomalies in the embedding space. According to experiments in Deep SAD, SSAD and Deep SAD are both state-of-the-art semi-supervised AD methods. Notice that here we use the improved version of Deep SAD called Hypersphere Classification (HSC) Ruff et al. (2020), which is about better than the original Deep SAD. DevNet introduces deviation loss and combines it with supervised loss to train an end-to-end anomaly scoring network. We combine the data-driven STOC method with both Isolation Forest and self-supervised representation learning method GOAD Bergman and Hoshen (2020). We reproduce DPLAN and include it in our baselines, considering that the distance calculation step in DPLAN is time-consuming, we decrease the sampling size from 1000 to 100. Finally, to make a comprehensive comparison, we also consider XGBoost and Isolation Forest, while XGBoost and Isolation Forest are classical supervised and unsupervised methods, respectively.
Scenario 1: Experiments on Datasets with Single Anomaly Class
In this scenario, we use datasets with single anomaly class to compare DADS with baseline methods. As stated above, there are two adjustable parameters: anomalies ratio and contamination ratio, we will fix one at a time and adjust another. The results of these two groups of settings are as follows. Detailed graphic results are shown in Appendix C, below we only list some processed results.
Setting 1.1: AUC versus incremental contamination ratio with fixed anomalies ratio.
First we set anomalies ratio to , which means the known anomalies account for of total anomalies. Next, we gradually increase contamination ratio from to , with interval set to , to test whether ADAS is more robust to pollution in unlabeled data compared with baselines. Here we report the result of DADS and baseline methods when in the upper half of Table 1, and the average rank of each method averages its ranking of results on different datasets. DADS ranks the first in both average AUC-ROC and average rank, which proves the advantage of DADS in resisting high contamination in unlabeled data.
Setting 1.2: AUC versus incremental anomalies ratio with fixed contamination ratio.
In this part, we set contamination ratio to and adjust anomalies ratio within range to see whether the search of possible anomalies makes contribution to the performance of DADS. Table 2 shows the results when , and the upper half corresponds to this setting. From the results we can see that DADS performs well when only a little labeled anomalies is available. Another interesting point is that the performance of some methods like IForest and STOC+IF declines as anomalies ratio increases, while DADS monotonically increases with the growth of anomalies ratio.
|Known AD Scenario|
|annthyroid||0.857 0.013||0.671 0.069||0.868 0.041||0.809 0.035||0.722 0.051||0.613 0.024||0.866 0.015||0.932 0.075||0.843 0.026|
|cardio||0.956 0.037||0.574 0.185||0.846 0.064||0.929 0.067||0.897 0.044||0.949 0.012||0.935 0.017||0.887 0.088||0.937 0.010|
|satellite||0.845 0.032||0.630 0.079||0.903 0.018||0.849 0.018||0.858 0.011||0.769 0.012||0.795 0.019||0.803 0.014||0.786 0.016|
|satimage2||0.990 0.006||0.886 0.105||0.970 0.034||0.989 0.022||0.973 0.012||0.957 0.023||0.994 0.003||0.960 0.029||0.994 0.003|
|thyroid||0.976 0.053||0.639 0.191||0.911 0.038||0.986 0.019||0.946 0.024||0.900 0.030||0.976 0.006||0.896 0.091||0.974 0.005|
|Average||0.925 0.028||0.680 0.126||0.900 0.039||0.912 0.032||0.879 0.029||0.838 0.020||0.913 0.012||0.895 0.060||0.907 0.012|
|Unknown AD Scenario|
|multiannthyroid||0.703 0.075||0.617 0.128||0.693 0.059||0.693 0.069||0.664 0.05||0.562 0.035||0.690 0.028||0.927 0.043||0.685 0.046|
|multicardio||0.978 0.013||0.561 0.091||0.921 0.030||0.927 0.049||0.897 0.045||0.860 0.029||0.802 0.029||0.823 0.028||0.881 0.016|
|multihar||0.977 0.011||0.712 0.13||0.898 0.127||0.966 0.015||0.987 0.002||0.766 0.058||0.916 0.014||0.882 0.081||0.920 0.013|
|Average||0.886 0.033||0.630 0.116||0.837 0.072||0.862 0.044||0.849 0.032||0.730 0.041||0.803 0.024||0.877 0.051||0.829 0.025|
Scenario 2: Experiments on Datasets with Multiple Anomaly Classes
The above experiments on datasets with single anomaly class shows the advantage of DADS in both the exploration of unlabeled dataset and robustness to contaminated data. For further verification, we conducted similar experiments on datasets with multiple anomaly classes. For each dataset, we set one anomaly as the known anomaly class while leave others as unknown. We believe that the tasks in this scenario will be more difficult and can better show the advantages of DADS. Same as above, detailed results are in Appendix C.
Setting 2.1: AUC versus incremental contamination ratio with fixed anomalies ratio.
Like setting 1.1, we set anomalies ratio to and adjust contamination ratio from to . An obvious phenomenon in Figure 2 is that as contamination ratio goes up, all methods except DADS experiences different degrees of decline, which again proves the robustness of DADS to contamination. The lower half of Table 1 summarizes the results when . Although slightly inferior to XGBoost in average AUC, DADS still ranks the first in average rank.
Setting 2.2: AUC versus incremental anomalies ratio with fixed contamination ratio.
Here we fix contamination ratio to and increase anomalies ratio from to . Average AUC results and rank are shown in Table 2 and DADS performs the best. We believe this should be attributed to the efficient search mechanism, which enables DADS to search for possible anomalies when there are multiple anomaly classes.
Analysis of Experiment Results
From the results of experiments conducted on two scenarios, we can summarize several empirical results.
DADS vs. DPLAN: We think it is necessary to make a comprehensive comparison between DADS and DPLAN, since they are all AD methods based on RL. According to the experiment results, DADS outperforms DPLAN in all two scenarios. To be specific, settings 1.1 and 1.2, especially datasets like cardio, satimage2, and multi-har prove the superiority of robustness of DADS to contamination. In settings 1.2 and 2.2, DADS outperforms DPLAN when only small amount of labeled anomalies is known, which should give credit to the SAC algorithm and the search mechanism that avoid the problem of DPLAN that only searches locally. Another advantage of DADS is that it removes the distance-based sampling strategy of DPLAN, thus accelerating training to a large extent.
DADS vs. unsupervised/supervised/semi-supervised AD methods: According to the experiment results, we can also make a comparison between DADS and different kinds of AD methods. First of all, compared with unsupervised methods like Isolation Forest, STOC+IForest, and STOC+GOAD, DADS has advantages in settings 1.2 and 2.2 since it can search and exploit unknown anomalies.
Secondly, though supervised methods like XGBoost achieve quite good results in some datasets like annthyroid, it cannot keep the advantage on all datasets, while the performance of DADS is relatively stable across different datasets. When the aomunt of known anomalies is extremely small(e.g. 1%), DADS also performs better than supervised methods, which can be verified in Figures S5 and S7 of Appendix C.
Lastly, compared with semi-supervised methods like DPLAN, DeepSAD, SSAD and DevNet, DADS outperforms them in all four settings. Figures S4 and 2 of settings 1.1 and 2.1 indicates that DADS is more robust to data contamination, especially when compared with supervised-based methods like DPLAN. In settings 1.2 and 2.2, different from unsupervised-based methods like SSAD and Deep SAD that reach performance plateau prematurely, DADS can maintain synchronous performance growth with the increases of known anomalies, which shows stronger ability in utilizing supervision signals.
To identify to what extent the search mechanism helps, we remove the search mechanism of DADS and leave other components unchanged, that is to say, no anomalies will be found and added into the anomaly dataset . Experiments of settings 2.1 and 2.2 are conducted on original DADS and DADS without search. We plot the result on multi_cardio dataset with line chart, which can demonstrate the advantage of DADS well. For detailed results of experiment, please refer to Tables S7 and S8 of Appendix D.
Ablation study on setting 2.1.
The left subfigure of Figure 3 shows that DADS with search is almost always better than DADS without search. Another point worth noting is that as contamination ratio goes up, the fluctuation of DADS without search is increasing, and the AUC of DADS with search is also increasing. We think that it is a convincing evidence of the importance of the search mechanism in DADS. Without search, DADS can neither clean the unlabeled data, nor acquiring new anomalies, thus suffering from the contamination issue.
Ablation study on setting 2.2.
From Figure 3 we can see that DADS with search is better than DADS without search across different amount of labeled anomalies. This result is consistent with our former analysis, since DADS can search for possible anomalies to improve its performance. While in contrast, DADS without search can only fit limited known anomalies. In Table S8 of Appendix D, the average results also prove the necessity of the search of DADS.
This paper presents an RL-based semi-supervised tabular AD method DADS. We use the idea of ensemble learning and design environment with hierarchically organized datasets to achieve better robustness to contaminated unlabeled data. By combining unsupervised AD methods into the sampling function, we further improve the effectiveness of the search mechanism. DADS performs well in experiments with various settings, which demonstrate its effectiveness.
- Deep reinforcement learning: a brief survey. IEEE Signal Processing Magazine 34 (6), pp. 26–38. Cited by: Introduction.
- Classification-based anomaly detection for general data. In International Conference on Learning Representations, Cited by: Competing Methods.
- Anomaly detection: a survey. ACM Computing Surveys 41 (3), pp. 1–58. Cited by: Introduction.
- Data-efficient and interpretable tabular anomaly detection. arXiv:2203.02034. Cited by: Semi-supervised Tabular Anomaly Detection.
- Semi-supervised learning. IEEE Transactions on Neural Networks 20 (3), pp. 542–542. Cited by: Semi-supervised Tabular Anomaly Detection.
- Reinforcement learning in economics and finance. Computational Economics, pp. 1–38. Cited by: Introduction.
- Xgboost: a scalable tree boosting system. In ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pp. 785–794. Cited by: Anomaly Detection, Competing Methods.
Histogram-based outlier score (hbos): a fast unsupervised anomaly detection algorithm.
German Conference on Artificial Intelligence, pp. 59–63. Cited by: Anomaly Detection.
- Pidforest: anomaly detection via partial identification. Advances in Neural Information Processing Systems 32. Cited by: Semi-supervised Tabular Anomaly Detection.
- Toward supervised anomaly detection. Journal of Artificial Intelligence Research 46, pp. 235–262. Cited by: Semi-supervised Tabular Anomaly Detection, Semi-supervised Tabular Anomaly Detection, Competing Methods.
- Soft actor-critic algorithms and applications. arXiv:1812.05905. Cited by: Deep Reinforcement Learning.
- Reinforcement learning: a survey. Journal of Artificial Intelligence Research 4, pp. 237–285. Cited by: Introduction.
- Actor-critic algorithms. In Advances in Neural Information Processing Systems 12, Cited by: Deep Reinforcement Learning.
- Deep learning. Nature 521 (7553), pp. 436–444. Cited by: Introduction.
- Isolation forest. In IEEE International Conference on Data Mining, pp. 413–422. Cited by: Anomaly Detection, Competing Methods.
- Asynchronous methods for deep reinforcement learning. In International Conference on Machine Learning, pp. 1928–1937. Cited by: Deep Reinforcement Learning, Deep Reinforcement Learning.
- Playing Atari with deep reinforcement learning. arXiv:1312.5602. Cited by: Introduction, Deep Reinforcement Learning.
- Human-level control through deep reinforcement learning. Nature 518 (7540), pp. 529–533. Cited by: Introduction, Deep Reinforcement Learning.
- Deep reinforcement learning for cyber security. IEEE Transactions on Neural Networks and Learning Systems. Cited by: Introduction.
- Deep learning for anomaly detection: a review. ACM Computing Surveys 54 (2), pp. 1–38. Cited by: Anomaly Detection.
- Deep anomaly detection with deviation networks. In ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pp. 353–362. Cited by: Semi-supervised Tabular Anomaly Detection, Competing Methods.
- Toward deep supervised anomaly detection: reinforcement learning from partially labeled anomaly data. In ACM SIGKDD Conference on Knowledge Discovery & Data Mining, pp. 1298–1308. Cited by: 2nd item, Introduction, Competing Methods.
- A unifying review of deep and shallow anomaly detection. Proceedings of the IEEE, pp. 756–795. Cited by: Anomaly Detection, Semi-supervised Tabular Anomaly Detection, Ensemble-based Sampling Function.
- Rethinking assumptions in deep anomaly detection. arXiv:2006.00339. Cited by: Competing Methods.
- Deep semi-supervised anomaly detection. arXiv:1906.02694. Cited by: 1st item, Semi-supervised Tabular Anomaly Detection, Competing Methods.
- Deep one-class classification. In International Conference on Machine Learning, pp. 4393–4402. Cited by: Competing Methods.
- Deep reinforcement learning framework for autonomous driving. Electronic Imaging 2017 (19), pp. 70–76. Cited by: Introduction.
- Estimating the support of a high-dimensional distribution. Neural Computation 13 (7), pp. 1443–1471. Cited by: Anomaly Detection.
- Trust region policy optimization. In International Conference on Machine Learning, pp. 1889–1897. Cited by: Deep Reinforcement Learning.
- Proximal policy optimization algorithms. arXiv:1707.06347. Cited by: Deep Reinforcement Learning.
- Mastering the game of Go without human knowledge. Nature 550 (7676), pp. 354–359. Cited by: Introduction.
- Semi-supervised anomaly detection algorithms: a comparative summary and future research directions. Knowledge-Based Systems 218, pp. 106878. Cited by: 2nd item.
- Dueling network architectures for deep reinforcement learning. In International Conference on Machine Learning, pp. 1995–2003. Cited by: Deep Reinforcement Learning.
- Simple statistical gradient-following algorithms for connectionist reinforcement learning. Machine Learning 8 (3), pp. 229–256. Cited by: Deep Reinforcement Learning.
- Self-trained one-class classification for unsupervised anomaly detection. arXiv:2106.06115. Cited by: 1st item, Competing Methods.
- Vime: extending the success of self-and semi-supervised learning to tabular domain. In Advances in Neural Information Processing Systems 33, pp. 11033–11043. Cited by: Anomaly Detection.
- Reinforcement learning in healthcare: a survey. ACM Computing Surveys (CSUR) 55 (1), pp. 1–36. Cited by: Introduction.
Normality-calibrated autoencoder for unsupervised anomaly detection on data contamination. arXiv:2110.14825. Cited by: Anomaly Detection.
PyOD: a Python toolbox for scalable outlier detection. Journal of Machine Learning Research 20 (96), pp. 1–7. External Links: Cited by: Ensemble-based Sampling Function.
- Sequential adversarial anomaly detection for one-class event data. arXiv preprint arXiv:1910.09161. Cited by: Introduction.
A: Algorithm of DADS
The training and inference procedures of ADAS are illustrated in Algorithms S1 and S2.
B: Details in Experiments
Preprocessing and acquisition of datasets
For all datasets used in experiments, we apply a train-validate-test split of . After that, minimax scaler will be applied to three datasets respectively. Validation set and testing set are fixed from then on, and we just need to generate the training dataset according to anomalies ratio, contamination ratio, and normalies ratio. Notice that for datasets with single anomaly class, anomalies ratio is calculated with regard to all anomalies, while for datasets with multiple anomaly classes, anomalies ratio is calculated with regard to the known anomaly class.
|Dataset||Normal Class||Anomaly Class|
|Dataset||Normal Class||Anomaly Class|
All datasets used in experiments can be accessed via links in Table S5.
Training of DADS
The training process of DADS is illustrated in Appendix A, and here are some details. First, in order to avoid possible overfitting, we use validation set to search for best training episodes. For each set of parameters, we will train the agent for 10 episodes and record the sum of AUC-ROC and AUC-PR after each episode of training and choose the one with the best result as the training episode used in the following training of 10 random seeds. The DADS experiments are run on an AWS C5.9xlarge instance with 36 Intel Xeon 3.6 GHz cores and 72 GB memory.
For unsupervised methods used in DADS (IForest, HBOS, and OCSVM), we fit them with unlabeled dataset before each episode.
The choice of parameter is also worth mentioning. As stated in Section 3.5, the search of anomalies should be accurate and efficient, which requires that the threshold should be set carefully. If threshold is too small, it is likely that normal data will be added to and cause contamination. If threshold is too large, no anomalies will be searched, and the whole DADS method is reduced to a method that simply fits the known anomalies. Here we design an adaptive threshold setting method, which can automatically set threshold after each episode of training. We initialize to a relatively large number , which can give the agent enough time to be trained to a reasonable action. If the number of searched anomalies in the current episode exceeds half of the number of known anomalies, will be added by to reduce the risk of being polluted. If no anomaly is searched for in the current episode, will be decreased by to increase the probability of the agent finding possible anomalies. For other conditions, will remain the same in the next training episode.
Other hyperparamters of DADS are listed in Table S6.
C: Experiment Results
D: Results of Ablation Study
|Dataset||contamination ratio||w. search||w/o search|
|Dataset||contamination ratio||w. search||w/o search|