{'fraction_non_alphanumeric': 0.027536911178814155, 'fraction_numerical': 0.006952581829544567, 'mean_word_length': 4.800407793384685, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Meta-Learning for Automated Selection of Anomaly Detectors for Semi-Supervised Datasets

In anomaly detection, a prominent task is to induce a model to identify anomalies learned solely based on normal data. Generally, one is interested in finding an anomaly detector that correctly identifies anomalies, i.e., data points that do not belong to the normal class, without raising too many false alarms. Which anomaly detector is best suited depends on the dataset at hand and thus needs to be tailored. The quality of an anomaly detector may be assessed via confusion-based metrics such as the Matthews correlation coefficient (MCC). However, since during training only normal data is available in a semi-supervised setting, such metrics are not accessible. To facilitate automated machine learning for anomaly detectors, we propose to employ meta-learning to predict MCC scores based on metrics that can be computed with normal data only. First promising results can be obtained considering the hypervolume and the false positive rate as meta-features.

1 Introduction automated machine learning (AutoML) [1] refers to the vision of automating the data science process emerging from the unmatched demand for expertise in data science and machine learning in particular. A substantial part of AutoML literature is concerned with the selection, configuration, and composition of machine learning algorithms tailored for a certain task, consisting of a dataset and a performance measure [2]. After first promising results for standard (binary or multi-class) classification and regression tasks on tabular data could be achieved [3,4,5], AutoML quickly spread to further data types, learning problems, and tasks, such as image classification [6], multi-label classification [7], remaining useful lifetime estimation in predictive maintenance [8], online learning [9], natural language processing [10], and multi-modal data [11]. While the aforementioned extensions of AutoML require supervision in terms of labels being provided for fitting the models, more recently, AutoML methods for dealing with unsupervised or semi-supervised machine learning tasks are proposed as well.
One such problem class deals with the detection of outliers, sometimes also referred to as anomalies. While performance complementarity can also be observed for anomaly detectors, i.e., for different datasets, different anomaly detection methods perform best, this setting imposes severe challenges for adopting AutoML methods to determine the most suitable anomaly detection method. First, if the provided dataset contains both classes at all, i.e., normal and anomalous, their frequency is typically unbalanced. More specifically, it is usually assumed that anomalies occur only with very low frequency. Second, the dataset at hand may comprise no anomalies at all, and the anomaly detection method is meant to detect any new data points that deviate from the training data and thus represent anomalies [12,13], e.g., in intrusion detection. In the following, we refer to this setting as being semi-supervised. For commonly available sampling-based AutoML approaches, the latter data situation is difficult to handle since they rely on probing sampled algorithms and hyperparameter values for the given data. For example, a solution candidate is evaluated via cross-validation and the average performance for a performance measure of interest is observed, e.g., error rate for classification or mean squared error for regression. Obviously, in the domain of anomaly detection, we are interested in finding a model that can detect anomalies reliably but also classifies normal data points as such. Performance measures such as Matthews correlation coefficient (MCC) or the area under the ROC curve are considered to account for the imbalance between normal and anomalous data points. However, these performance measures require the presence of both types of data points normal and anomalous data points such that they cannot be computed in the semi-supervised setting mentioned above.
In this paper we investigate the use of meta-learning to overcome the issue of evaluating algorithms and their hyperparameter values for a performance measure of interest, which may require data points of both classes. To this end, we assess the predictive power of two metrics that can be computed with normal data points only: hypervolume of anomaly detectors and the false positive rate (FPR). In our experimental section, we find promising results when utilizing these metrics in terms of meta-features for landmarking and feature descriptions of anomaly detectors.

CASH for Semi-Supervised Anomaly Detection
Let X and Y = {0, 1} be an instance space and a target space respectively. Furthermore, we assume instances x ∈ X to be (non-deterministically) associated with a label y ∈ Y. In the setting of anomaly detection, we associate instances x with y = 1 in case it is an anomaly and y = 0 if it is normal. Moreover, anomalies are assumed to occur only seldomly, i.e., y = 1 is a minority class, and during training only normal data points are provided. This setting is also occasionally referred to as semi-supervised anomaly detection [12]. For convenience, let {0} =: Y 0 ⊂ Y. We seek to learn a hypothesis h : X → Y from training data given in the form of D = {(x i , y i ) ∈ X × Y 0 | 1 ≤ i ≤ n} that is able to discriminate well between normal and anomalous data points.
Let be A := {A (1) , A (2) , . . . A (m) } a set of anomaly detectors with corresponding hyperparameter spaces Λ (1) , Λ (2) , . . . Λ (m) . Additionally, a dataset of training , and a performance measure m : Y × Y → R, we aim to find the most suitable anomaly detector A * together with its hyperparameter setting λ * with respect to m: where A (i) λ is trained on training data D and makes a prediction on x which is then compared to the ground truth y and without loss of generality m is to be maximized. This problem is better known as the combined algorithm selection and hyperparameter optimization (CASH) problem as initially formalized in [3].
To find such an A * λ * , in sampling-based AutoML systems, one would split the dataset D into subsets of training and validation data D train and D val respectively and use the performance on the validation data as an estimate of the true generalization performance:

Related Work
To the best of our knowledge, there are no other publications that focus on combined algorithm selection and hyperparameter optimization (CASH) in a semi-supervised setting. Therefore, we refer to unsupervised approaches and semi-supervised hyperparameter optimization approaches in this section.
In [14], Zhao et al. present MetaOD, an approach to unsupervised outlier model selection. It is based on the construction of meta-features for a corpus of training datasets with outlier labels and the performance of over 300 models for each dataset. Similarly to our evaluation, Zhao et al. use the meta-features and performance values to train a performance predictor, which is used to choose high performing models for new datasets. However, we focus on the semi-supervised setting of outlier detection rendering landmark features meant to capture information regarding potential outliers not applicable.
Putina et al. introduce AutoAD [15], a framework with the same purpose as MetaOD but without utilizing meta-learning. They measure the performance of an anomaly detector via metrics applied to the data before and after removing the top-ranked anomalies predicted by the detector in question. Again, this approach is not applicable to our semi-supervised setting as the employed metrics imply the existence of anomalies in the tails of the data distribution. We do not assume any anomalies being present in the datasets for which an anomaly detector is to be optimized. Other approaches like PyODDS [16], TODS [17], AutoOD [18], and LSCP [19] utilize supervised performance metrics rendering them not applicable to our semi-supervised setting too.
Tax et al. have a body of works evolving from the idea of the hypervolume of one-class classifiers as being the hypervolume of the subspace that a one-class classifier predicts to belong to the target class [20,21,22]. In [21], they aim at optimizing the hyperparameters of the support vector data description. For this purpose, they estimate the hypervolume of the support vector data description and use a linear combination of this estimation and the FPR (error on the target class) as performance metric for optimization. The linear combination encompasses a trade-off parameter that has to be set manually.
Our approach is motivated by this idea to a large extend. However, we focus on the more general CASH problem. To this end, we evaluate the utilization of the hypervolume and the FPR as features description of anomaly detectors and for landmarking purposes. Furthermore, we train a meta-model for the prediction of the quality of anomaly detectors on unseen datasets.

Meta-Learning for Selecting Anomaly Detectors
According to the assumption that D only contains normal data, i.e., data points of the form (x j , y j ) with y j ∈ Y 0 , performance measures that quantify how accurately an anomaly detector may identify anomalies, e.g., via MCC, precision, recall, or AUC, cannot be assessed for evaluation. Hence, such measures can neither be employed by AutoML systems to search for the most appropriate anomaly detector for a given data set.
To overcome this issue, we aim to substitute the performance measure m in Eq. 2 by a surrogate model m, which provided a feature description f A ∈ R k of algorithm A (i) together with its hyperparameter setting λ and a feature description f D ∈ R l of the dataset D in question predicts the measure of interest. To this end, the surrogate is build on data sets for which anomalies are actually known and hence a performance value can be computed. Then, we can substitute m by m in Eq. 2 to obtain In the following we consider mainly two types of features as to describe algorithms as well as datasets (in terms of landmarking features): hypervolume and FPR.
Hypervolume The hypervolume can be considered as a means to describe how tightly an anomaly detector fits the normal data points. With a smaller hypervolume, chances are low that anomalies are missed, whereas a larger hypervolume may lead to anomalies not being identified as such. False Positive Rate The FPR assesses how many data points in the training data are falsely classified as anomalies, i.e., the anomaly detector would raise a false alarm in this case.
It is easy to see that minimizing both the hypervolume and the FPR is conflicting with each other. Therefore, we seek to find a method yielding a suitable tradeoff between the two measures.

Experimental Evaluation
In the following we assess the predictive power of the hypervolume and the FPR for the task of selecting a suitable anomaly detector for an unseen dataset. First, we consider a linear combination of the features to order anomaly detectors and evaluate the general usefulness of these metrics in terms of a feature description of the detectors. Second, we train a meta-model to predict the MCC score of anomaly detectors. This model gets as an input landmarking features resulting from the hypervolume and FPR of a fixed portfolio of anomaly detectors and the hypervolume and FPR of the anomaly detector in question. Figure 1 shows the process that we follow for our experiments. We continuously refer to this figure in the course of this section. All experiments of the evaluation were executed on virtual machines with Ubuntu 20.04.4, 16 cores (Intel Xeon E5-2695 v3), and 128 GB RAM. Sections 5.1 and 5.2 elaborate on the assimilation of the meta-learning dataset and a correlation analysis respectively. Thereafter, Section 5.3 discusses the results of the evaluation.

Meta-Learning Dataset Assimilation
We base our meta-learning datasets on a number of datasets for outlier detection. The source of these datasets is the collection of Tax et al. [24]. The estimation of the hypervolume of anomaly detectors, which we explain in the context of the corresponding activity, scales poorly with an increasing number of dimensions. Thus, we only select those datasets that have 8 features or less, resulting in 15 Base Datasets, which can be inferred from Table 1. We execute the Meta-learning Dataset Assimilation activity iteratively for all 15 Base Datasets.
One of our basic assumptions is that outliers are the minority class (cf. Section 2). Not all of the datasets reflect this assumption. Thus, we Sub-sample Outliers to ensure that anomalies constitute between 5% and 10% of the total dataset. We do this only for those datasets, where outliers originally amount to more than 10% of the dataset. To Create the Train and Test Datasets, we shuffle the Base Dataset and perform a stratified split into Train (70%) and Test Datasets (20%). The remaining 10% are kept for future experiments that are not in the focus of this publication. Furthermore, we remove all outliers from the Train dataset to match our semi-supervised setting. Lastly, we scale the Train and Test Datasets, subtracting the mean and scale the features independently to the interquartile range with respect to the Train Dataset. Figure 1 shows, that the control flow forks at this point into the Construct Landmark Dataset and Construct Detector Dataset activities. These activities extract our meta-features, which are meant to characterize datasets and anomaly detectors, respectively.
The landmark features are the hypervolume and the FPR of the Anomaly Detectors provided by PyOD 4 [25] in their default configuration. Here, we exclude those algorithms that do not finish after one week of runtime for each dataset resulting in at most 18 Anomaly Detectors per Base Dataset.
The estimation of the hypervolume that a model spans with respect to a certain dataset follows the approach of Tax et al. [22]. Correspondingly, we fit the smallest hyper-sphere around the train data and generate 35 million uniformly distributed data instances within this sphere. We train the Anomaly Detectors on the Train Dataset. The fraction of instances classified as belonging to the target class is an estimate of the hypervolume of the corresponding anomaly detector. Please note, that we inferred the number of generated data instances from initial experiments. Generally, the number of necessary data instances grows exponentially with the number of dimensions of the Train Dataset. This is the reason for the aforementioned bad scaling of the hypervolume estimation. To Compute the FPR, we execute a monte-carlo cross validation with a 30% test-size and ten repetitions on the Train Dataset.
The parallel activity Construct Detector Dataset extracts the hypervolume, the FPR, and the MCC of 50 randomly configured Anomaly Detectors of PyOD per Train Dataset. The estimation of the hypervolume of these 50 Anomaly Detectors and the FPR follows the computations in the context of the Landmark Dataset explained above. We use the MCC of these anomaly detectors as a performance measure, which we compute on the corresponding Test Dataset. If the feature extraction via a particular anomaly detector does not terminate within 5 hours (while executing 4 anomaly detectors in parallel), we replace it with a newly configured anomaly detector.
The last activity is Combine Datasets, which uses the Landmark Dataset and the Detector Dataset to create the Meta-learning Dataset. We combine the features of the former datasets such that each instance of the resulting Metalearning Dataset encompasses all landmarking features of the Train Dataset and the detector features of one particular anomaly detector. After the creation of these datasets, the control flow forks again. The lower control flow ranks the Anomaly Detectors covered by the Meta-test Dataset according to the simple linear combination of their detector features as a score:

Correlation Analysis
The upper control flow ranks the Anomaly Detectors via a meta-model that predicts the MCC of the Anomaly Detectors covered by the Meta-test Dataset based on the landmarking and detector hypervolume and FPR features. We opt for a mean strategy to Impute Missing Values. Furthermore, we use the Meta-train Dataset to train a random forest regressor (Meta-Model) in default parameterization 5 . Thereafter, we rank the Anomaly Detectors of the Meta-test Dataset using the predicted MCC of the Meta-Model as a score.
We execute the Compute Metrics activity for the Linear Ranking and the Meta-learn Ranking separately. At the beginning of the activity, we scale the MCC to the [0, 1] interval to avoid coping with negative scores. As metrics, we use the regret@k, Kendalls rank correlation coefficient (τ ) [26], and the normalized discounted cumulative gain (NDCG) [27], which are metrics that refer to rankings.
We base our evaluation on ranking metrics because a correct ranking of anomaly detectors is more important to guide an AutoML system than precise prediction of an anomaly detectors performance, e.g., in terms of the mean squared error. While a high precision in the predicted quality is certainly desirable, it is not necessary for choosing the most promising out of a set of anomaly detectors.
Here, a precise ranking is sufficient.
The regret@k compares the performance of the best model within a top-k ranking with the actual best model known for a dataset and reports the absolute difference. In our case it refers to the scaled MCC and gives an intuition about the performance of the top-ranked anomaly detectors.
τ measures the correspondence between two rankings, which are the ranking given by the method in question and the optimal ranking given by the true MCC values. τ ranges in the interval [−1, 1] where negative values indicate a negative correlation of the rankings and positive values a positive correlation. We utilize the b-version of τ , which accounts for ties.
Similarly, the NDCG is a measure to compare a predicted ranking to an optimal one. In comparison to τ , the actual scores (in our case the scaled MCC values) influence the NDCG and not only the ranking inferred from those scores. The NDCG ranges in the [0, 1] interval where values close to 1 denote a high quality of the predicted ranking.

Results
In this section, we discuss the performance of the Linear Ranking and Metalearn Ranking approaches discussed in Section 5.2. Due to the lack of directly comparable approaches (cf. Section 3), we introduce three different baselines. Table 1 reports on the performance of the approaches with respect to the metrics introduced in Section 5.2. Additionally, it reports the maximum, mean, and minimum of the MCC of the anomaly detectors considered for prediction scaled to [0, 1] to give an impression of the corresponding distribution. Please note that the NDCG is generally not particularly insightful and reported for completeness.
Baselines: The first baseline approach is based on randomization. Here, we report the mean values of 50 randomized rankings. The second approach utilizes the FPR detector feature introduced in Section 5.1 and ranks the 50 anomaly detectors per dataset with the inversed FPR (1 − F P R(A λ )) as score. The last baseline approach works analogously to the second one but uses the inverse of the hypervolume detector feature. Table 1 shows the conflicting nature of the FPR and hypervolume features already mentioned in Section 4 as good τ performances for one approach are typically accompanied with rather poor ones for the other. Additionally, the regret and τ indicate that the FPR is more informative than the hypervolume. One possible reason for this is that the FPR directly influences the MCC but the hypervolume only if it correlates with the false negative rate. This is not necessarily the case, e.g., if an anomaly detector exactly covers the hypersphere, which in turn does not cover any anomalies. Furthermore, the hypervolume is Table 1. Correlation analysis results. Small arrows indicate whether a metric is to be maximized or minimized where the best performance per dataset and metric is bolded. For datasets marked with a † , anomaly detectors considered for prediction have a mean scaled MCC score of at least 0.6, meaning they actually are capable of identifying anomalies reasonably. We use the following abbreviations for the ranking approaches: R = random, FPR = false positive rate, HV = hypervolume, L = linear combination, M = meta-model, and very sensitive to noisy features. An anomaly detector can expand in the direction of such features and drastically increase its volume without affecting its MCC.
Linear Ranking: Ranking according to the linear combination of hypervolume and FPR detector features, yields decent results. The linear combination of the hypervolume and the FPR seems to be a suitable means to compare different anomaly detectors to each other and rank them accordingly. Particularly when comparing the combined approach with the separate baselines introduced before, we see that the combination outperforms the separate approaches. For 5 datasets the linear rankings have the top detector in the first place and for two more datasets it is within the top-5 ranked detectors. Furthermore, we see that the mean and median of τ indicate a positive association in relation to optimal rankings. However, investigating τ for the datasets separately yields that 5 datasets show negative τ values, which is also the reason for the relative low mean and median τ of .14 and .16, respectively. Cross-checking these results with the mean MCC values of the 50 randomly configured anomaly detectors per dataset indicates a strong relation. If we restrict the evaluation to those datasets with a mean scaled MCC of at least .6, we end up with a mean regret@1 of 0.05, regret@5 of 0, NDCG of 0.97, and τ of 0.38 (not shown in Table 1). Hence, the features seem to be more informative for those datasets for which we randomly find better anomaly detectors on average.
Meta-learn Ranking: Using the hypervolume and FPR as meta-features for both datasets and the anomaly detector is clearly worse than the linear combination of the detector features alone. Overall, it can be regarded as being on par with the randomized approach.
However, a leave-one-out evaluation on cherry picked datasets -analogously to what we describe in the context of the linear ranking -leads to the meta-model slightly outperforming the cherry picked linear ranking in terms of the mean NDCG and τ . Thus, we once more see a strong relation to particularities of the corresponding meta-learning datasets and the performance of the encompassed anomaly detectors, which -obviously -the landmarking features cannot sufficiently express. Additionally, the hypervolume estimation is very sensitive to the data distribution of the target class. On the one hand, for distributions well approximated by the sampled hypersphere, a good anomaly detector has a hypervolume close to 1. On the other hand, for a distribution on a submanifold, the hypervolume of a good detector tends towards 0. This relation might be hard to learn. Still, we find the results to be promising, particularly considering that we do not assume any information regarding the outlier class of the unseen dataset. Thus, they form a potential base from which interesting future work may emerge. Especially, whether additional meta-features, other types of meta-models, or improved sampling strategies for the hypervolume estimation may help to improve the accuracy of the predictions for the MCC.

Conclusion
In this paper, we have considered the learning problem of anomaly detection where during training only a dataset with normal data points is available. While this impedes the use of performance measures explicitly quantifying how well an anomaly detector is able to identify anomalies, for the task of automatically selecting and configuring anomaly detectors, we proposed to employ meta-learning to predict measures of interest. In this regard, we considered mainly two types of meta-features. One that is based on the hypervolume covered by trained anomaly detectors and the other one considering the FPRs of anomaly detectors. While a lower value for the former seems favorable as the anomaly detector fits the training data more tightly, this is usually in conflict with minimizing the FPR since the smaller the hypervolume, the more training data points may be classified as positive. Used in combination, the two features have shown promising performance to be used directly for ranking anomaly detectors and as metafeatures for a meta-model to predict a measure of interest that would actually require anomalies in the training data for being evaluated. Moreover, results of the corresponding experiments, which can rather be considered a proof of concept, indicate that AutoML for anomaly detectors might be feasible using such surrogate measures for performance evaluation.
Whether AutoML systems can really work well with such surrogate models for selecting and configuring anomaly detectors, however, is still an open question and also outlines interesting future work. Thus, we aim to extend our approach by augmenting the set of meta-features by more types of informative features describing the data or the anomaly detector, to improve the quality of the metamodel. Other research directions are too improve the hypervolume estimation and to formalize the problem directly as ranking problem.