Detecting Novel Processes with CANDIES -- An Holistic Novelty Detection Technique based on Probabilistic Models

In this article, we propose CANDIES (Combined Approach for Novelty Detection in Intelligent Embedded Systems), a new approach to novelty detection in technical systems. We assume that in a technical system several processes interact. If we observe these processes with sensors, we are able to model the observations (samples) with a probabilistic model, where, in an ideal case, the components of the parametric mixture density model we use, correspond to the processes in the real world. Eventually, at run-time, novel processes emerge in the technical systems such as in the case of an unpredictable failure. As a consequence, new kinds of samples are observed that require an adaptation of the model. CANDIES relies on mixtures of Gaussians which can be used for classification purposes, too. New processes may emerge in regions of the models' input spaces where few samples were observed before (low-density regions) or in regions where already many samples were available (high-density regions). The latter case is more difficult, but most existing solutions focus on the former. Novelty detection in low- and high-density regions requires different detection strategies. With CANDIES, we introduce a new technique to detect novel processes in high-density regions by means of a fast online goodness-of-fit test. For detection in low-density regions we combine this approach with a 2SND (Two-Stage-Novelty-Detector) which we presented in preliminary work. The properties of CANDIES are evaluated using artificial data and benchmark data from the field of intrusion detection in computer networks, where the task is to detect new kinds of attacks.


INTRODUCTION
Today, so-called "smart" or "intelligent" technical systems are often equipped with abilities to act in real environments that are termed to be "dynamic" in the sense that their characteristics are time-variant (change over time). But typically, knowledge about the basic nature of these changes is built into these systems and it is assumed that only the time when these changes occur cannot be predicted. Future systems, however, have to evolve over time. Not all knowledge about any situations the system will face at run-time will be available at design-time. That is, the system has to detect and react on fundamental changes in time-variant environments. As C. Gruhl  an example, we may consider technical systems that make observations of their environment with sensors and classify these observations (samples). In a timeinvariant environment, there may be different causes for different kinds of observations (called "processes" in the following). The data are modeled (e.g., by means of probabilistic models such as Gaussian mixtures) and then a classifier is built (e.g., by gradually assigning components of the Gaussian mixture to classes). At runtime, the data model and the classifier are not adapted.
An example for such a system could be a machine, that produces various parts (cf. left part of Figure 1). A process in this hypothetical environment would be similar to the production of a certain part. If the system is monitored with multiple sensors (e.g., S1 and S2), the resulting sensor signals span a two-dimensional input space (as shown in the middle part of Figure 1). Each value pair is called an observation or sample. With suitable machine learning techniques we can approximate the resulting distribution of samples. On the right side of Figure 1 a Gaussian mixture model (GMM, cf. 4.1) is used to approximate, and thus modeling, the sample distribution. Ideally, each component of the GMM describes a physical process in the environment. Reasons to rely on GMM for this purpose is that arbitrary continuous densities can be approximated by GMM (with any desired precision, based on the number of components) and the generalized central limit theorem, which states that the sum of i.i.d. random samples tends to be normally distributed (assumed, that the variance is finite). In technical system this is frequently the case, since observed sensor values are often the outcome of various random parameters that influence each other. In a time-variant environment, there may eventually be some conspicuous samples (cf. Fig.  2). Then (if the system is able to detect such a situation), some questions come up: Are these samples outliers of existing processes or not? If not, is there an anomaly in the observed environment or did a new process emerge that was unknown at design-time? And how can we build novelty detection methods to identify such novel processes? How can we adapt the data model to suit the changed environment and when (in order to find On the left: abstract machine with monitoring sensors S1 and S2. In the middle: the two-dimensional input space consisting of measured sensor signals from S1 and S2. In this case, the outcomes of three different processes are gathered in three clusters. On the right: approximated density model, the ellipses are called components and correspond to multivariate Gaussians that represent the physical processes. A situation with samples produced by three processes (represented by three components and marked in red) and a model of the situation with three components. Some observations appear in a low-density region and are "suspicious", they may indicate that a novel process currently emerges.
With CANDIES (Combined Approach for Novelty Detection in Intelligent Embedded Systems), some of the questions can be answered. One major challenge is the reliable detection of (possibly multiple) novel processes in the complete input space. Herby we assume that the input space is divided into two parts: 1) High-density regions (HDR): These are regions that are already covered by one or more components of the mixture model (i.e., the support of the kernels, in our case Gaussians, is high). This implies that normal observations are expected to appear in these regions and thus forming the normal model. However, new processes might also emerge here (e.g., "close" to, or between existing components, or even . Same situation with samples produced by three processes (represented by three components and marked in red) and corresponding model. Some observations (green circles • and blue crosses +) in the highdensity region covered by the model components, are the outcome of two not yet known processes and should be considered to be "suspicious".
totally overlapping these) and therefore change the characteristics of the approximated density. We assume that HDR can be considered to be spatially compact in the input space, and that they contain the majority of the overall density mass. 2) Low-density regions (LDR): These regions are distant from any component centers, resulting in a low support of the kernels. Thus, normal data is not expected to be observed here and observations appearing here are considered to be suspicious. In contrast to HDR we assume, that LDR are widely spread in the input space and that usually only a single LDR exists (i.e., not separated by HDR).
The transition between HDR and LDR is not strictly defined and is application dependent. Caused by their different characteristics, different problems are faced to detect novel processes. Since LDR have a potentially infinite support, the main difficulty is to efficiently find spatial relations (i.e., clusters) between suspicious observations. On the other hand, for HDR, two issues must be addressed: 1) which observations are assumed to be normal (outcome of an already known and modeled process) and which are suspicious (i.e., outcome of a novel process, or anomalies). 2) When is a novel process present. In a preliminary article (see [15]), we presented 2-SNDR, an approach to solve the novelty detection problem sketched above for situations, where novel processes start to "generate" data in LDR of a probabilistic knowledge model (based on Gaussian mixtures). Figure  2 depicts such an exemplary scenario (where a novel process is emerging in a LDR). To detect novelty in HDR CANDIES relies on a new approach that is premised on statistical goodness-of-fit testing (i.e., measuring how well observed samples fit the assumed distribution), adjusted to suite Gaussian mixture models (GMM, cf. Section 4.1) and online environments. Figure 3 shows a different situation, where two novel processes started to "generate" samples in a HDR, but are not yet represented in the current model.
Altogether, it is possible to address a specific kind of time-variance in the observed environment which is useful for many applications. We may imagine other kinds of situations where processes disappear (obsoleteness) or change some basic parameters (concept shift or concept drift). Our current research addresses these situations as well.
The remainder of this article is organized as follows: Section 3 gives a broad overview of related work, including other common novelty detection techniques, related topics, and what are the distinctions to CANDIES. Section 4 briefly summarizes methodical foundations essential for this article. Preliminary to the technical in depth details, a simplified overview of the idea behind the proposed technique is given in Section 2. The main body, introducing CANDIES in detail, is contained in Section 5. In Section 6 a small case study based on the KDD Cup 99 Computer Intrusion data set is presented. Finally, a conclusion and outlook to future work is given in Section 7.

OVERVIEW OF CANDIES
With CANDIES we aim on three main goals: 1) Detecting clusters of suspicious samples (i.e., those that differ notably from what is expected). 2) Detecting such clusters in the complete input space, that is, in LDR and in HDR. 3) using the discovered clusters to model new processes.
The algorithms consists of multiple detectors for HDR and a single one for the LDR. It works (simplified) in the following manner. The foundation of the whole approach is a GMM, that provides a density estimate of the expected data. An advantage of GMM is that they can easily be extended to a classifier and that they belong to the family of generative models, thus additional structural information about the expected observations can be deduced (in contrast to discriminative classifiers, e.g., SVM). At first a new sample x located either in a HDR or in a LDR. Depending on the location it is marked as normal (located in HDR) or suspicious (located in LDR) (suspicious is what comparable algorithms mark as novelties). Depending on that decision either the LDR detector or one of the HDR detectors is responsible for handling the new sample. If the sample is marked as suspicious the sample is stored in a ring buffer on which a nonparametric clustering is performed. If a cluster in the buffer reaches a certain size the detector will report the detection of a novel process. Otherwise, when the sample is regarded as normal, it is used to update one of the HDR-Detectors (there is one HDR-Detector for each individual component of the GMM), the decision which detector is updated is made at random. The HDR-Detector works by testing how well the last m samples are fitting the estimated Gaussian bell. This is done by using a χ 2 test. If the t-value exceeds the critical value the detector reports the detection of a novel process.

RELATED WORK
The main task for a Novelty Detector is to distinguish if a previously unseen sample belongs either to a normal model or if it is different in some way so that it does not belong to the normal data and is therefore novel. Closely related to the topic are the fields of anomaly and outlier detection. Over a decade ago it was sufficient to roughly group novelty detection approaches into two classes: either statistical (cf. [24]) or neural network based (cf. [25]).
Most of the statistical approaches are relying on a model of the processed data. Observations are identified as (potentially) novel if they differ to much from what is expected, e.g., described by an appropriate model. Further, these approaches can be discerned based on the models they are using -either parametric or nonparametric models. Novelty detection techniques based on nonparametric density modeling are, for example, those using k-nearest neighbors approaches or kernel density estimators, see [37] for a sample application in intrusion detection. Parametric models on the other side make assumptions about the distribution of the observed samples, e.g. Gaussian mixture models. In preliminary work [12] we detect novelty based on a parametric Gaussian mixture model and a state variable which monitors how well the observations fit the model. The approach is used for comparison to CANDIES and briefly presented in the case study in Section 6.
The second group comprises detection techniques that are based on neural networks, e.g., multi-layer perceptrons, radial basis function neural networks, [4], [6] but, according to Markou and Singh [25], also include methods based on support vector machines, e.g. One-Class SVM as described by Tax and Duin [35].
Since the early 2000s, the topic draw much attention as objective of research and changed considerably (i.e. new ranges of applications or whole new techniques, due to advances in computing power). Now, a more recent survey [29] suggest five different categories to group novelty detection approaches: i) probabilistic, ii) distance-based, iii) reconstruction-based, iv) domainbased, and v) information theoretical.
The first category covers a large part of the approaches that where previously affiliated with the statistical group. Typically these techniques are build upon a parametric density estimation of training data as a model. Frequently used are mixtures of Gaussians ( [12] [20], [38], for instance). Novelty is usually detected if samples are observed in low-density-regions (i.e., the density for the observed sample is below a selected threshold). Several method to define a threshold are based on Extreme Value Theory (EVT, cf. [8], [18], [32]). The idea in EVT is to estimate the distribution of extreme values (i.e., maximum or minimum for legit samples) for a given density model and a given sample size. Then, samples that exceed the expected maximum or surpass the expected minimum are identified as novel. Recently Extreme Learning Machines with decision making depending on EVT where proposed by Al-Behadili et al. [2] to implement incremental semi-supervised learning based on novelty detection. Thus, probabilistic approaches are not limited to generative models, cf. [10], for example, where Support Vector Machines are used for detection and resulting novelty values calibrated in order to be interpreted as class-conditional probabilities.
To the second category belong approaches that are based on distances. Popular representatives of this category are approaches based on k-nearest-neighbors (knn). E.g., [7] or [17], [27], where the latter use the density of a k-neighborhood (i.e., a radius required to enclose k neighbors) to identify novel samples. A sample is novel if its neighborhood density is considerably lower than the density of its neighbors. Clustering based approaches refer also to category ii). Typically, normal samples are aggregated to form clusters, novelty is then determined by the minimal distance of an unseen sample to any centroid (e.g. [33], [36]). It is questionable whether category i) and ii) are sharply differentiable. Gaussian Mixture Models for example, consists of multiple location invariant kernels and the density is finally greatly dependent on the applied distance measure.
Our new CANDIES approach does not fit into a single category but is a hybrid in the sense that it belongs to the first two categories: probabilistic and distance-based. For a detailed summary of the remaining categories iii), iv), and v) cf. [29].
However, most of the introduced paradigms are designed to spot only single samples as novelties and do not relate those samples to one another. Thus, potential new knowledge (structural information in form of a cluster, that is evidence of a novel physical process) is unexploited and discarded. In some common applications such as medical condition monitoring [9], [31], [34] or machinery monitoring [30], this is not a real drawback, since anomalies might arose everywhere in the input space and are very specifically stuck to a concrete application (i.e., monitoring a specific patient or a specific engine). But in other fields, such as network intrusion detection, this discovered knowledge has great potential to be used to detect future attacks.
The contributions of this article are: 1) CANDIES is trimmed to detect novel processes (clusters of suspicious observations, cf. knowledge) in such a way, that the process can easily be integrated as new component into the existing GMM. This leads to the result, that learning does not only happen in a isolated training phase, off-line at design-time, but it is also conducted at run-time [16].
2) Novelty is not only detected in low-density regions (where normal observations are not likely to appear), but also in high-density regions, i.e., where normal observations are expected.

METHODICAL FOUNDATIONS
For the purpose of a self-contained article, we briefly recap the most important techniques used to implement our approach. This includes an overview of Gaussian mixtures, a method to extend those to a classifier, a short introduction to nonparametric density estimation as foundation for cluster analysis, and a brief description of statistical goodness-of-fit testing.

Gaussian Mixtures
One frequently used approach to generative modeling is the Gaussian mixture model (GMM). That is, a superposition of multiple multivariate normal distributions (denoted as N and commonly referred to as Gaussian) and a mixing coefficients π j (Eq. (1)). Each Gaussian is called a component and has its own set of parameters which are the mean vector µ j ∈ R D and a covariance matrix Σ j (with dim(Σ j ) = D × D) that describes its shape. The mixing coefficients π j (with constraints J j=1 π j = 1, π j ∈ R + ) ensure that the resulting p(x) (x ∈ R D is the random variable) still fulfills the requirements for a density function. They may also be interpreted as priors for each component (i.e, the probability that an unobserved sample is generated by the corresponding component). Altogether, we get: (1) (a) Training set with classes green circle • and blue cross +. The resulting GMM is trained in an unsupervised manner and models the density with three components.  . Each × denotes the center µ j of the j-th component while each ellipse represents the shape which is defined by the j-th covariance matrix Σ j . The distance between µ j to the associated ellipse, which is a constant density surface, corresponds to a Mahalanobis distance of 1.
An ordinary GMM models only the density of an associated training set and can be trained in an unsupervised manner (i.e., labels are not required). Since the sufficient statistics for the components cannot be computed in closed form, we pursue this goal with an expectationmaximization (EM) like approach that uses 2nd order (or hyper-) distributions and is heavily based on variational Bayesian inference (VI). An extensive introduction to VI is given by [5]. For clarification, a trained GMM for a two-dimensional data set is shown in Figure 4(a).
Relying on VI gives rise to two advantages: (1) prior knowledge about the data can be included, which is especially valuable in real-world applications, and (2) multiple GMM can be fused into one model as described in [14]. The final GMM is obtained from the expectations (a point estimate from the second-order distributions) of the hyper-distributions after the VI training finishes.
Since we assume a certain functional form of the underlying distribution and estimate its parameters, GMM are parametric density models.

Classification Paradigm
To derive a classifier h(x) from the trained density model p(x), we estimate the class posteriors p(c|x) in a second, supervised (i.e., with respect to class labels) iteration. The classification of a given sample x is then done, as shown in Eq. (2) by selecting the maximum a-posteriori (MAP) of the class probabilities: with where Eq. (4) shows the responsibilities γ x,j which are the probability that a given sample x was generated by the j-th component. For each component j and class c the conclusion is determined by Eq. (5), which is the fraction of all responsibilities for samples x n ∈ X c that are labeled with class c and the effective number of samples (denoted as N j = N n=1 γ xn,j ) belonging to the j-th component (X is the overall set of labeled samples, X c the subset of X associated with class c).
Finally, the class posteriors p(c|x) given in Eq. (3) are a composition of the responsibilities γ x,j and the class conclusions ξ j,c . The resulting decision boundary, which describes the classifier for the previously estimated density model, is shown in Figure 4(b).

Density Based Clustering
Rather than assuming a specific functional form such as parametric methods, nonparametric techniques provide a point estimate for the density p(x) at a given point x. One well-known nonparametric method is the Parzen window (or kernel) density estimator, here with Gaussian kernel: It is the sum of a finite set of N samples x n of an underlying training set to which an appropriate kernel function is applied to. The kernel is placed at the point x where the density should be estimated. The parameter h is a smoothing factor that controls how smooth the estimation is while D is the number of dimensions. Closely related to the Parzen window are histograms (cf. [5]). The DBSCAN clustering algorithm (cf. [11]) uses a density estimation that is quite similar to a Parzen window estimator. Based on the density at each sample the algorithm decides whether a sample belongs to, lies at the edge, or is outside a cluster (in that case it is considered as noise). To do so, the kernel in Eq. (7): is used which forms an D-dimensional sphere around the point x with radius . Typically, dist is realized with an Euclidean metric. If a sample is part of a cluster, all samples inside the sphere are also assigned to the same cluster. The advantage of this approach is that clusters of arbitrary shapes can be identified.

Statistical Goodness-of-Fit Tests
To validate whether an observed sample matches a hypothesized distribution or not, goodness-of-fit tests can be applied. A fast and reliable method is Pearson's chi-squared (χ 2 ) test [28]. The test compares observed frequencies from mutually exclusive events (finite set of possible outcomes/values of a discrete random variable) against expected theoretical frequencies (obtained from a suitable fitted distribution) of these events. The test statistic (or t-value) is calculated by: where x i is the observed event frequency of event i and k is the total number of different events. The expected frequencies of events i are given by e i : where P fit is the fitted distribution. The test aggregates the squared deviations between observed and expected frequencies and weights them by the expected frequency. This leads to stronger penalties when only small frequencies are expected. To accept or reject the null-hypothesis that the sample is drawn from the hypothesized distribution the t-value must be less than the critical value: The critical value is calculated by evaluating the inverse cumulative density function F −1 of the χ 2 distribution with ν degrees of freedom at point 1 − α. Where α is the significance level which implies that the error rate for type I errors is at most α (often α = 5% or 1%). The degrees of freedom ν are given by the number of events minus the number p of covariate parameters Θ of the fitted density P fit (e.g., p = 2 for univariate Gaussian with Θ = (µ, σ)). Figure 5 emphasizes the relation between the χ 2 distribution of t-values and the critical value χ 2,upper for a significance level of α = 5%.

ONLINE NOVELTY DETECTION
This section is split into three parts: the first part is based on our previous work [15] and discusses novelty detection and reaction in LDR with 2SND. The second part treats novelty detection in HDR with online capable χ 2 goodness-of-fit tests. The last part then introduces CANDIES a detector which is able to detect novelties in the whole input space by combining both previously mentioned techniques. All techniques share the property to be applicable to online environments (i.e., soft realtime).

Novelty Detection in Low-Density Regions
To detect novel processes in sparse LDR we developed the 2 Stage Novelty Detection (2SND) algorithm. The algorithm works on top of an existing GMM or CMM (as described in Section 4.2) and extends it with novelty detection capabilities. Further, with 2SND it is possible to update the underlying GMM/CMM and to enhance them by including components that model the detected novel processes.
The algorithm itself consists of two procedures: a main procedure 2SND (Alg. 1) and an auxiliary procedure PROPAGATE, that propagates the cluster id to all affiliated samples using a modified breadth-first search.
To detect novel processes, we propose a two-stage approach which identifies suspicious samples in the first stage and novel processes in the latter. Each assessed sample is individually tested how well it suits the current model by determining whether it resides in a high-(HDR) or low-density region (LDR). This is done by exploiting the fact that the squared Mahalanobis distances between samples from a Gaussian j to its mean µ j : are such that a fraction α of samples (which belong to the Gaussian) have a smaller squared Mahalanobis distance to the mean as ρ. Figure  6 depicts the relationship for one-and two-dimensional Gaussians.
Separating the input space into HDR and LDR simplifies the model considerably. Legitimate samples are assumed to appear in the dense regions while samples in the low-density regions are less likely to be observed. To detect novel processes in HDR additional detectors are required (cf. Section 5.2), since 2SND focuses only on LDR. By selecting α we specify how much of the total probability mass is covered by HDR, thus defining the transition between HDR and LDR. Samples with a Mahalanobis distance of ∆ j (x) ≤ ρ to at least one of the component centers µ j are located within a HDR and therefore seen as not suspicious. Samples with a higher distance ∆ j (x) > ρ to all centers are regarded as being suspicious. This complies to the first stage of our novelty detection. Figures 6(b) and (c) are illustrate an exemplary situation for a GMM with a single component and different values of α. Observations inside the α-region (which is equal to a HDR) are depicted by circles •, while suspicious samples (located in a LDR) are shown as triangles . The first stage is implemented in the first part of the procedure 2SND given in Alg. 1.
The second stage utilizes a density based clustering approach. Each sample x that is identified as being suspicious is cached in a circular buffer B with sizeb. Based on the distance to the nearest neighbor of x in B, the algorithm decides if x belongs to an already existing cluster. This behavior depends on the kernel given in Eq. (7) with being the maximum distance between a sample x and its nearest neighbor and it is implemented in the second part of the 2SND procedure, given in Alg. 1. If the sample is associated with a cluster C, the cluster is extended to include all -neighbors (i. e., all buffered samples with a distance dist(x , x B ) ≤ ). This is achieved with the procedure PROPAGATE, which is basically a breadth-first search with constraints. In fact, (a) A normal distribution with mean µ = 0 and variance σ 2 = 1.
The darker green area shows the region where 66% of the probability mass is located. The combination of both areas corresponds to a mass of 90%. Since the squared distances are χ 2 1 distributed, the radii of the areas are equal to the root of the quantile function F −1  (α) to their center. Samples displayed as red triangles are suspicious (potentially novel), while samples depicted as blue circles • are not suspicious. High-density regions (HDR) are colored in blue, low-density regions (LDR) in red.
expanding a cluster can lead to a merger of multiple clusters and, thus, create a much larger cluster.
A novel process is detected as soon as a cluster C fulfills the adaptation criterion |C| ≥ minP ts which corresponds to the number of samples that are associated with the cluster C. In Section 5.3.2 a measure is proposed to represent the current amount of novelty in LDR in human readable form.

Model Adaptation
The last part of the 2SND procedure is responsible for deciding whether a novel process exists in the monitored LDR and how the model is adapted. If a new process in form of a cluster is identified, the underlying GMM needs to be updated. This is done by performing a VI training on all samples that are associated with the corresponding cluster. After that training step, the novel process is represented by another GMM. To update the model, we exploit the properties of the hyperdistributions and use a fusion technique proposed in [14]. To fuse two given GMM we measure the pairwise divergence between each component and fuse only those which exceed a given threshold (0.5). In this case, we may assume that both components model the same process. This might happen, if a process emerges close to the border if the α-region (which also separates LDR from HDR). As divergence measure the Hellinger distance is used (cf. [3], [19]). The actual fusion combines the hyper-parameters of both components. Non-overlapping components are simply inserted into the existing model. In each case the hyper-distributions of the mixing coefficients must be adjusted, such that the mixing coefficients of the combined GMM still form a distribution. After this fusion step, the model is adapted to the changes in its environment and all samples belonging to the cluster C are removed from buffer B. If the updated model is used as the base for a classifier, the conclusion for the new component must be determined. Possible solutions to this problem are the involvement of a human domain expert, if meaningful labels are required, or the automatic generation of new, unique labels. As investigated by [12], it is also possible to exchange knowledge with other systems so that a novel process can be faster detected by another system. This kind of behavior is especially interesting for cyber-physical systems that share knowledge about their environment.
For clarification, an exemplary scenario that highlights the important operational phases of the new approach is shown in Figure 7.

Novelty Detection in High-Density Regions
The above presented method detects suspicious samples in LDR only. However, observations in HDR are always considered as being normal, thus making this approach unable to detect novel processes there. For the moment we focus on the detection of overlapping processes for single components and later extend the idea to also suit GMM (where multiple components are present). The difficulty in detecting novel processes in dense regions is that we cannot decide if an observed sample is the legitimate outcome of a known (i.e., the existing component) or from an unknown overlapping process without knowing its affiliation (which in this case is a latent variable). We therefore make use of a sliding window that keeps track of the last ω observed samples, no matter if they are actually novel or not. It is clear, that if a novel process is present (that deviates at least in it's mean or covariance from the existing component) the observed sample population (i.e., the content of the sliding window) will not match the distribution (described by the component) anymore and a noticeable difference between population and component has to be measurable. Due to their high computational complexity divergence measures such as the Kullback-Leibler divergence [22] or Hellinger distance [19] are intractable for the measurements, especially if the input space is of high dimensionality. To tackle this problem we do not measure the divergence of the sliding window and the existing component directly, instead we test how well the distances between samples in the buffer an the component's center suit the expected distribution (which is a χ 2 distribution as stated in Section 5.1). This task can be performed by using the χ 2 test described in Section 4.4. Since the test is performed on the sliding window, the approach is suitable for online environments.

Transformation of the distance distribution
One of the requirements of the χ 2 goodness-of-fit test is, that the different events must be mutually exclusive. Therefore the continuous distance density must be transformed into a discrete one. Since any distribution (a) Initial training set with samples from two different classes, green circle • and blue cross +. The density model is trained with VI and extended to a classifier as described in Section 4.2.   (d) After the apperance of some more suspicious samples, the cluster in the upper center reached a certain size and is considered to be a novel process. Its samples are isolated and used to train a parametric model with VI. (e) After the VI training converges, the novel process is represented by a GMM which consists of a single component. The newly acquired knowledge will be fused with the initial model shown in (b).  is normalized (i.e., p(x)dx = 1) and, furthermore distances (here x) are always strictly positive it is quite easy to transform the density of distances into a discrete, uniform distribution.
Choosing a finite uniform distribution with λ events (also cells, or buckets) brings several advantages including constant calculation of expected frequencies: The fitted uniform distribution has only one free parameter (λ), therefore the degree of freedom is given by: To do the actual transformation the boundaries of the individual cells (cell i ) must be estimated so that each cell is equally likely. This is done with the inverse cumulative density function F −1 of the continuous density (as stated before χ 2 d for multivariate Gaussians with d dimensions) by dividing the density into λ areas of equal size: Thus the first cell always begins at 0, and the last one is unbounded (right boundary is → ∞). Now, if a previously unseen sample x is observed it is stored in the sliding window buffer and a counter b i for the responsible cell cell i is incremented. The lookup for the correct cell can be done in O(log n) (e.g., using a tree structure). The t-value for the current buffer configuration at time point n is then calculated as follows: with The expected value e i is only approximated by ω λ since the buffer can be not completely filled (i.e., contains less than ω samples). If the buffer is at capacity when a new observation x is processed, the oldest element gets removed. The t-value is compared with significance of α = 0.01 = 1% against the critical value: If t > χ 2,upper k the threshold is exceeded and the detector reports novelty. Figure 8 shows on the left an exemplary data set with a single component trained to fit the green circles •. Additionally the set contains samples from three more processes (purple + crosses around (0.5, 1.5), red triangles around (−2, 3), and blue • circles close to the components center around (−2, 1.5)). All additional processes represent novelties and appear in the given order. The image on the right shows the curve of the calculated t-values for the sliding window in red. When samples from the novel processes appear the curve changes and exceeds the critical value (given as black line) considerably.
The signal is however noisy, so that at some points of time the critical value is slightly exceeded even though no novel processes are present. To compensate for this effect smoothing the t-values with a moving average: where M is the number of considered previous t-values, is a promising approach as the blue curve on the right image of Figure 8 illustrates.

Learning of the distance distribution
Real world data sets or sensory data from embedded systems often differ from their assumed distributions. Whereas this is not a problem for classification for our goodness-of-fit approach to novelty detection it is, as the t-value curve in Figure 9 highlights. Here a single Gaussian is fitted based on the depicted samples, which are uniformly distributed rather than normal. Therefore the distances are not χ 2 distributed as it is presumed by our test and the critical value is almost permanently exceeded by the test statistics. The problem can be solved by estimating the cell boundaries directly from the samples X train that are used to train the component: where ∆(x) is the Mahalanobis distance to the center µ of the component. By using the distance of every i · w element of the order samples each cell contains approximately the same number of entries, thus forming again a discrete uniform distribution. The computationally most complex part is the sorting of the training samples X train , which can be done in O(n · log n). Note that the last cell λ might be underestimated due to the rounding. In Figure 10 the ordered training set X train is depicted. The y-axis (index of the sorted samples) is divided into λ = 12 equally sized parts (each part corresponding to a cell) the associated function arguments on the x-axis (distances to component center) are equal to the interval boundaries. If the curve is normalized an approximation of the cumulative density function of the real distance distribution can be obtained. Figure 11 shows the resulting t-value curves of two uniform distributed data sets (on the left the same example as in Figure 9 with 2 dimensions, on the right another sample set with 5 dimensions) where the expected frequencies for the test are estimated according to Equation (21). The (moving-average) curves are now clearly below

Extension to Gaussian Mixture Models
To extend the high-density approach to GMM with multiple components, each component needs its own detector. If a new sample x is observed it should be used to update the detector of its affiliated component. The affiliation is however a latent variable and thus not known at run-time. One method to estimate the affiliations is (Monte Carlo) random sampling, which requires only the evaluation of the unnormalized (without mixing coefficient π j ) densities P j (x ) = N (x |µ j , Σ j ) for each component j and a continuous uniform pseudo random number generator unif(0, 1) for the unit interval [0, 1]. The sampling works by partitioning the unit interval into J parts. Each partition m j is associated with exactly one component j and the boundaries are given by: where p x ,j are the normalized densities to ensure that the support of the individual parts sum up to 1. To identify a winner component (i.e., the one that will be affiliated with the observation x ) a random value r is drawn from the uniform generator unif(0, 1). The partition m j that covers the drawn value r indicates the winning component j. Figure 12(a) shows clouds (5000 samples, 2 dimensions, 2 classes) a widely used artificial data set from the UCI Repository [23], with trained classifier. The CMM is trained in 5-fold cross-validation fashion, where four  folds are used for the actual training and the remaining fold for testing. This leads to an experiment where no novel (unknown) processes are present since all folds contain samples from all four known processes. The test result for one experiment is displayed in Figure  12(b). The curve shows the average high-density novelty measure (discussed in Section 5.3.2), which does not exceeded the critical value that is given by the black line and has a constant value of 1, thus indicating that no novel processes are present. The test statistics of the individual component detectors are depicted in Figure  13.
A modified test setup for clouds is illustrated in Figure  14(a). Here the training is performed on 2000 samples and the remaining 3000 samples are interspersed with 400 samples from two overlapping novel processes (red triangles). The novel processes appear around time steps 1000 and 2200. The corresponding high-density novelty measure curve for the experiment is given in Figure 14 Figure 15. From the curves it can be inferred that the main contributions for the detection is from the component (bottom right) that represents blue + crosses.

CANDIES
CANDIES is our holistic approach to detect novelty in high-as well as in low-density regions of a GMM. This is achieved by using a single 2SND (cf. Section 5.1) detector combined with multiple HDR detectors for each component (cf. Section 5.2.3).

Requirements to merge LDR and HDR detectors
For the system to operate some adjustments are necessary. At first a previously unseen sample x is checked whether it is located in an HDR or not (similar to the first stage of 2SND). If this is not the case, the sample is passed to the second stage of 2SND and the density based clustering is refreshed. At this point a novel process might be detected. Otherwise, the in Section 5.2.3 described random sampling is executed and x gets affiliated with exactly one of the components J. Then

Algorithm 2 CANDIES
Input: sample x , parameters α, ω , ,minP ts,b Global: model M, buffer B Initialize ρ = F −1 {decide if x is located in high-or low-density region} for this component j a new t-value is estimated and compared against the critical value. At this point an overlapping novel process might be detected.
Since samples x with a distance ∆ j (x ) > ρ for all j ∈ J are always processed by the LDR detection part, the assumed distance distribution of the components HDR detectors will not match the observed samples. However, by establishing the following dependency λ = 1 1−α between the 2SND LDR detector and the HDR detectors, and adjusting the calculation of the t-values to: the last cells cell λ are representing exactly the fraction α of samples that are located in LDR (but with e λ = 0) while the first λ − 1 cells cover the remaining 1 − α percentage. The critical value is changed to: Thus the goodness-of-fit test is adjusted to evaluate only the frequencies of samples expected to appear in HDR. The whole approach is summarized and commented in Algorithm 2. Figure 16 shows another modification of the previously used clouds data set. Again, additional samples (red triangles) from two novel processes are interspersed. The locations are chosen in a way so that one process (centered around (1, 1)) shares a large fraction of its support with two of the known processes, while the other one (centered around (−2, −2)) is positioned in a low-density region. The t-value curves of the four known components are illustrated in Figure 17. Furthermore the novelty measures (discussed in Section 5.3.2) given in Figure 18 clearly indicate novelty in the expected time ranges (blue bars rising to 1). The left curve gives the novelty value in low-density regions, where the first novel process starts generating samples around time stamp ≈ 1000. On the right curve the average novelty measure for high-density regions is illustrated. Here, the novel process gets also detected but a small delay between appearance of novel samples (around ts ≈ 2000) and the detection can be observed. This is most likely due to the random sampling, which disperses novel samples to multiple components.

Novelty Measure -Human Readability
We propose two novelty measures to quantify how much novelty is present in different regions (i.e. HDR or LDR) in a way that is comprehensible for (data scientists). Therefore, the measures should express the absence of a novel process (or novelty) with a value near 0, while the presence of such a process should be expressed by a value ≥ 1.
The measure ν 2snd for LDR is given by:  Figure  16).On the left: 2SND-novelty curve indicating a novel process in low-density regions around ts ≈ 1000. On the right: average-novelty curve that represents novelty in high-density regions. The rising of the blue bars around ts ≈ 2150 and ≈ 2900 are indicating that a novel process is present.
Where |B| is the number of observations currently stored in the buffer, |C| is the number of different cluster, and |N oise| the number of samples associated with the noise cluster. If a single cluster that contains most samples currently kept in the buffer is present (which is a strong indicator for a novel process), the measure will be close to 1. On the other hand, if all samples are considered to be noise or multiple clusters with only a few samples are present, the novelty value will be closer to 0. The HDR measureν (average novelty) is based on the geometric mean of the normalized t-values ν j of the individual components: The normalization constant is given by the critical value.
As Equation (32) shows, the ν j are passed to a function w which is a non-linear transform that boosts values near 1: The idea here is that if multiple components approach the critical value (an indicator for novel process located between these components) the novelty measure should also express this. If the model however consists of considerably more components (with t-values distant from the critical value), the mean is dominated by these components. Thus boosting values already close to 1, allows to overcome the normal components to increase the mean, so that novelty is also expressed there. Exemplary curves for both measures are given in Figure 18 (novel processes present) and Figure 19 (only normal processes observed).

Overview of Parameters
CANDIES comes along with a considerable amount of adjustable parameters. Table 1 gives an overview of all parameters present in CANDIES including a short description, recommendations for (good) default values (if possible), and which detector is influenced by the parameter. Note, that especially the buffer-size parameters are application-dependent on how many novel processes are expected to appear at once, and how many samples they will generate.

Handling of Noise
Since the novelty detection is designed to detect novel processes and not single observations, it is rather robust against distributed noise in the input space. While novel samples of a novel process will appear in a dense form, random noise is scattered across the input space so that it is quite unlikely to form sufficiently large clusters. For the LDR detection part (based on 2SND) the robustness is achieved by the two stage architecture that suspicious samples pass through. Figure 20 shows a scenario that includes uniformly distributed noise that is mixed into a test set with observations from one known process and one novel process (located to the right, outside of the α-zone in low-density region). Depending on its parametrization, the LDR approach only detects a novel process where the novel observations are actually located. Figure 21(a) depicts the same exemplary data set that is already used in Section 5.2.1 interspersed with uniform random noise (purple + crosses). The corresponding t-value curve is displayed in Figure 21(b) and shows a recognizable up-shift, introduced by the noise. Nevertheless, this undesired effect can be circumvented by adjusting the distance distribution according to Section 5.2.2. The curve of the adjusted test is illustrated in Figure 21(c). The course of the moving-average is now clearly below the threshold in intervals where no novelty is present, but rises clearly -although weaker as compared to the application without noise -above the critical value, when the novel processes start to generate samples. Therefore the high-density approach  (a) Test set consisting of samples from one previously known process (green circles •), noise samples (red triangles ) and samples from a novel process (blue crosses +) .

An alternative view on CANDIES
At first the two different approaches to novelty detection for LDR and HDR might seem quite different. It is, however, possible to get a consistent view by interpreting one detector by means of the other. As mentioned before, the last bins cell λ of each HDR detector matches the lowdensity parts of the input space. Therefore the ring buffer B used for 2SND can be seen as a shared cell across all HDR detectors. On the other hand, the individual buffers of each HDR detector allow an interpretation as clusters (with a different adaptation predicate P ), and thus suiting the 2nd stage of 2SND.

CASE STUDY
To validate that the presented approach can be used to real-world applications, we show experimental results (a) The same data set as in Figure 8 but with uniform noise added (purple crosses +). (c) Test statistics over time for estimated distance distribution. Fig. 21. Scenario with samples from three novel processes and additional uniform distributed noise that is scattered in the input space and corresponding test curves: test statistics (red) and moving average test statistic (blue).
based on the well-known KDD Cup 1999 network intrusion data set [21]. Even though it is pointed out that there are some serious flaws in the data set, which makes it inappropriate for the evaluation of real intrusion detection systems, its properties are still suitable for our purposes, since we are not interested in building a state of the art intrusion detection system.

Setup
As mentioned before, our new approach is compared to a novelty detection technique that is proposed in [12].
Here, novel samples are also identified using a GMM and the squared Mahalanobis distance between processed samples and the mean of the different components. Each time a new sample is processed, an internal state variable S n is updated, such that S n = S n−1 + χ 2 nov , with: of each component are evaluated and the results are multiplied with the responsibilities of the components. If the algorithm is processed in an environment without emerging processes, the expectation of the state variable will be equal to its initial value E[S n ] = 1. The presence of a novel process will lead to a decrease of the value of the state variable S n . This can be exploited to detect novel processes as soon as the state variable underflows a given threshold (here: 0.2). The parameter η controls how fast the state variable changes (here: 0.001). This causes a model adaptation that uses the last 500 observations to retrain the model, which is done with a modified VI algorithm, that allows to insert new components into an existing GMM and train only those, keeping the existing components "fixed". After the model is adapted to its changed environment, the state variable is reset to its initial value. We refer to this approach as CSND (χ 2novelty detection) Originating from the various recorded connections in the KDD99 data set, different attack scenarios are sampled (these are: ipsweep, neptune, nmap, satan, and smurf). Each scenario consist of background connections (legitimate network traffic) and connections related to the specific attack. A dimension reduction to 6 out of the 41 dimensions is performed as preprocessing step. Additionally and due to the massive support in terms of categories, we interpret the discrete attributes as nearly continuous. Each scenario consists of three parts with an overall of 25000 connections. The first part contains 10000 connections drawn from a pool of background connections only. The second part is a mixture of background and attack connections (with the attack name as label) with a ratio of 3:1 and a total of 10000 connections. The last 5000 connections form the third part, which again consists only of legitimate traffic.
Both adaptive classifiers are trained with the first 5000 samples of the first part of each scenario to learn an initial GMM with VI. The experiments themselves are conducted in a 5-fold cross-validation fashion, with independent folds for the train sets, which consist of connections from the first and third parts of each scenario, and a single test set that is equal to the second part of each scenario.
Additionally, to get a baseline for the classification performance, a static classifier (as described in Section 4.2, referred to as GMM-Static) is trained on samples of all classes (background connections and attacks). That is, this classifier can be seen as omniscient as it anticipates future attacks that are completely new and unpredictable for the two adaptive classifiers above. In order to get meaningful results, a stratified 5-fold cross-validation, with all connections mixed together, is carried out. Then the accuracy and the F 1 -score of the class assigned to samples of the novel process are used to evaluate the classification performance.

Results
The resulting averaged classification performances are summarized in Table 2, which states that both adaptive approaches are able to identify the attacks and perform model adaptations that integrate the acquired knowledge. In all scenarios, the accuracy and the observed F 1score of CANDIES is equal or higher compared to those of the CSND approach. In three out of five scenarios our approach performs comparably well as the static baseline and still satisfiable on the other two. The higher performance of CANDIES over CSND is explained by Table 3, which shows the average number of actual novel samples (samples actually belonging to the attack) that are processed before the novel process is detected and a model adaptation triggered. Here CAN-DIES displays its strength to exploit spatial information between suspicious samples in LDR the form of clusters, which accelerates the detection compared to the slowly changing state variable of CSND.
The algorithm is designed to be processed in an online mode. Therefore, the number of triggered model adaptation steps and the number of inserted components are also investigated. Table 4 shows the averaged number of adaptation and insertion steps for each scenario. As   we can see, both approaches tend only to a single model adaptation, which is the optimum here. The CSND approach has fewer model adaptations on average than the CANDIES, but has a higher average number of inserted components, which is not negligible since the number of components in the GMM has a direct influence on the run-time of both algorithms.

CONCLUSION AND OUTLOOK
We introduced CANDIES, a holistic approach to novelty detection for (new) emerging processes throughout the complete input space of a probabilistic classifier. To achieve this, different novelty detectors for low-density regions (LDR, where it is less likely to observe samples) and high-density regions (HDR, samples are expected to be observed here) are combined and thus able to cover the complete input space. For LDR we resort on 2SND, this algorithm works with two stages. First, suspicious observations are identified with the help of a GMM (which are based on parametric densities). In the second stage, suspicious samples are then clustered in a nonparametric way (inspired by DBSCAN). A novel process is recognized as soon as one of the (nonparametric) clusters reaches a sufficient size. The detection in HDR on the other hand is purely based on parametric density estimation. We showed how to use multiple detectors (one detector per component) to identify novelty in GMM. The presence of novel processes in HDR is directly identified. This is accomplished by maintaining a sliding window of recent observations and performing statistical goodness-of-fit tests between sliding window and the affiliated component. In a compact case study in the field of computer network intrusion detection, we could show that CAN-DIES is applicable to real-world data sets. We tested it on a subset of the well-known KDD Cup '99 Intrusion Detection data set, where rather promising results were obtained. So far, first experiments on artificial laboratory data sets lead us to the conclusion that CANDIES will be a satisfactory solution to novelty detection with model adaptation in the near future.
In our future work we will focus on extending the described novelty detector further, this includes in particular reaction procedures for the HDR detection. We will elaborate the performance of CANDIES on more sample applications, e.g., in the fields of robotics or video based surveillance. Detection and handling of obsoleteness or concept shift will be accomplished with techniques similar to the ones proposed here. The same holds for concept drift, but here, it will be quite difficult to effect the trade-off between under-and overreaction (too early or too late). The accuracy of our techniques must be set in relation to a "degree" of time-variance in the observed system. It will be possible to detect emergent phenomena in the observed environment and to numerically assess the degree of emergence (cf. [13]). Also, these techniques allow for an application to various anomaly detection problems. Furthermore, the design of the approach is not necessarily limited to GMM but applicable to other mixture models as well.
Another possible application field that could benefit from our proposed technique are systems equipped with awareness capabilities. Often, terms such as locationaware, context-aware, self-aware, or environment-aware are used in the literature (see, e.g., [1], [26]). In our opinion, awareness is essentially • the capability to compare knowledge about the self, the environment, other systems etc. to current observations in order to detect when expectations concerning current observations do not meet the actual observations anymore and • the ability to adapt the knowledge model in a way such that the system meets some performance requirements which includes a solution to the problem when to adapt the model in odrder to avoid a performance loss either due to too fast or too slow reactions. Altogether, awareness techniques will be a key to develop new kinds of technical systems that could actually be termed to be "intelligent" or "smart" with some higher degree of justification.