Group Anomaly Detection using Deep Generative Models

04/13/2018 ∙ by Raghavendra Chalapathy, et al. ∙ 0

Unlike conventional anomaly detection research that focuses on point anomalies, our goal is to detect anomalous collections of individual data points. In particular, we perform group anomaly detection (GAD) with an emphasis on irregular group distributions (e.g. irregular mixtures of image pixels). GAD is an important task in detecting unusual and anomalous phenomena in real-world applications such as high energy particle physics, social media, and medical imaging. In this paper, we take a generative approach by proposing deep generative models: Adversarial autoencoder (AAE) and variational autoencoder (VAE) for group anomaly detection. Both AAE and VAE detect group anomalies using point-wise input data where group memberships are known a priori. We conduct extensive experiments to evaluate our models on real-world datasets. The empirical results demonstrate that our approach is effective and robust in detecting group anomalies.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 12

page 13

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Anomaly detection: motivation and challenges

Group anomaly detection (GAD) is an important part of data analysis for many interesting group applications. Pointwise anomaly detection focuses on the study of individual data instances that do not conform with the expected pattern in a dataset. With the increasing availability of multifaceted information, GAD research has recently explored datasets involving groups or collections of observations. Many pointwise anomaly detection methods cannot detect a variety of different deviations that are evident in group datasets. For example, Muandet et al. [20] possibly discover Higgs bosons as a group of collision events in high energy particle physics whereas pointwise methods are unable to distinguish this anomalous behavior. Detecting group anomalies require more specialized techniques for robustly differentiating group behaviors.

GAD aims to identify groups that deviate from the regular group pattern. Generally, a group consists of a collection of two or more points and group behaviors are more adequately described by a greater number of observations. A point-based anomalous group is a collection of individual pointwise anomalies that deviate from the expected pattern. It is more difficult to detect distribution-based group anomalies where points are seemingly regular however their collective behavior is anomalous. It is also possible to characterize group anomalies by certain properties and subsequently apply pointwise anomaly detection methods. In image applications, a distribution-based anomalous group has an irregular mixture of visual features compared to the expected group pattern.

In this paper, an image is modeled as a group of pixels or visual features (e.g. whiskers in a cat image). Figure 1 illustrates various examples of point-based and distribution-based group anomalies where the inner circle contains images exhibiting regular behaviors whereas images in the outer circle represent group anomalies. For example, the innermost circle in plot (A) contains regular images of cats whereas the outer circle portrays point-based group anomalies where individual features of tigers (such as stripes) are point anomalies. On the other hand, plot (A) also illustrates distribution-based group anomalies where rotated cat images have anomalous distributions of visual cat features. In plot (B), distribution-based group anomalies are irregular mixtures of cats and dogs in a single image while plot (C) depicts anomalous images stitched from different scene categories of cities, mountains or coastlines. Our image data experiments will mainly focus on detecting group anomalies in these scenarios.

Figure 1: Examples of point-based and distribution-based group anomalies in various image applications. The expected group behavior represents images in the inner concentric circle while the outer circle contains images that are group anomalies.

Even though the GAD problem may seem like a straightforward comparison of group observations, many complications and challenges arise. As there is a dependency between the location of pixels in a high-dimensional space, appropriate features in an image may be difficult to extract. For effective detection of anomalous images, an adequate description of images is required for model training. Complications in images potentially arise such as low resolution, poor illumination intensity, different viewing angles, scaling and rotations of images. Like other anomaly detection applications, ground truth labels are also usually unavailable for training or evaluation purposes. A number of pre-processing and extraction techniques can be applied as solutions to different aspects of these challenges.

In order to detect distribution-based group anomalies in various image applications, we propose using deep generative models (DGMs). The main contributions of this paper are:

  • We formulate DGMs for the problem of detecting group anomalies using a group reference function.

  • Although deep generative models have been applied in various image applications, they have not been applied to the GAD problem.

  • A variety of experiments are performed on both synthetic and real-world datasets to demonstrate the effectiveness of deep generative models for detecting group anomalies as compared to other GAD techniques.

The rest of the paper is organized as follows. An overview of related work is provided (Section 2) and preliminaries for understanding approaches for detecting group anomalies are also described (Section 3). We formulate our problem and then proceed to elaborate on our proposed solution that involves deep generative models (Section 4). Our experimental setup and key results are presented in Section  5 and Section  6 respectively. Finally, Section 7 provides a summary of our findings as well as recommends future directions for GAD research.

2 Background and related work on group anomaly detection

GAD applications are emerging areas of research where most state-of-the-art techniques have been more recently developed. While group anomalies are briefly discussed in anomaly detection surveys such as Chandola et al. [4] and Austin [10], Xiong [27] provides a more detailed description of current state-of-the-art GAD methods. Yu et al. [32] further reviews GAD techniques where group structures are not previously known however clusters are inferred based on additional information of pairwise relationships between data instances. We explore group anomalies when group memberships are known a priori such as in image applications.

Previous studies on image anomaly detection can be understood in terms of group anomalies. Quellec et al. [22] examine mammographic images where point-based group anomalies represent potentially cancerous regions. Perera and Patel [21] learn features from a collection of images containing regular chair objects and detect point-based group anomalies where chairs have abnormal shapes, colors and other irregular characteristics. On the other hand, regular categories in Xiong et al. [28] represent scene images such as inside city, mountain or coast and distribution-based group anomalies are stitched images with a mixture of different scene categories. At a pixel level, Xiong et al. [29] apply GAD methods to detect anomalous galaxy clusters with irregular proportions of RGB pixels. We emphasize detecting distribution-based group anomalies rather than point-based anomalies in our subsequent image applications.

The discovery of group anomalies is of interest to a number of diverse domains. Muandet et al. [20] investigate GAD for physical phenomena in high energy particle physics where Higgs bosons are observed as slight excesses in a collection of collision events rather than individual events. Xiong et al. [28] analyze a fluid dynamics application where a group anomaly represents unusual vorticity and turbulence in fluid motion. In topic modeling, Soleimani and Miller [25] characterize documents by topics and anomalous clusters of documents are discovered by their irregular topic mixtures. By incorporating additional information from pairwise connection data, Yu et al. [33] find potentially irregular communities of co-authors in various research communities. Thus there are many GAD application other than image anomaly detection.

A related discipline to image anomaly detection is video anomaly detection where many deep learning architectures have been applied. Sultani et al.

[26] detect real-world anomalies such as burglary, fighting, vandalism and so on from CCTV footage using deep learning methods. In a review, Kiran et al. [15] compare DGMs with different convolution architectures for video anomaly detection applications. Recent work  [23, 31, 3] illustrate the effectiveness of generative models for high-dimensional anomaly detection. Although, there are existing works that have applied deep generative models in image related applications, they have not been formulated as a GAD problem. We leverage autoencoders for DGMs to detect group anomalies in a variety of data experiments.

3 Preliminaries

In this section, a summary of state-of-the-art techniques for detecting group anomalies is provided. We also assess strengths and weaknesses of existing models, compared with the proposed deep generative models.

3.1 Mixture of Gaussian Mixture Models (MGMM)

A hierarchical generative approach MGMM is proposed by Xiong et al. [29] for detecting group anomalies. The data generating process in MGM assumes that each group follow a Gaussian mixture where more than one regular mixture proportion is possible. For example, an image is a distribution over visual features such as paws and whiskers from a cat image and each image is categorized into possible regular behaviors or genres (e.g. dogs or cats). An anomalous group is then characterized by an irregular mixture of visual features such as a cat and dog in a single image. MGM is useful for distinguishing multiple types of group behaviors however poor results are obtained when group observations do not appropriately follow the assumed generative process.

3.2 One-Class Support Measure Machines (OCSMM)

Muandet et al. [20]

propose OCSMM to maximize the margin that separates regular class of group behaviors from anomalous groups. Each group is firstly characterized by a mean embedding function then group representations are separated by a parameterized hyperplane. OCSMM is able to classify groups as regular or anomalous behaviors however careful parameter selection is required in order to effectively detect group anomalies.

3.3 One-Class Support Vector Machines (OCSVM)

If group distributions are reduced and characterized by a single value then OCSVM from Schölkopf et al. [24] can be applied to the GAD problem. OCSVM separates data points using a parametrized hyperplane similar to OCSMM. OCSVM requires additional pre-processing to convert groups of visual features into pointwise observations. We follow a bag of features approach in Azhar et al. [1], where -means is applied to visual image features and centroids are clustered into histogram intervals before implementing OCSVM. OCSVM is a popular pointwise anomaly detection method however it may not accurately capture group anomalies if the initial group characterizations are inadequate.

3.4 Deep generative models for anomaly detection

This section describes the mathematical background of deep generative models that will be applied for detecting group anomalies.

3.4.1 Autoencoders:

An autoencoder is trained to learn reconstructions that are close to its original input. The autoencoder consists of encoder

to embed the input to latent or hidden representation and decoder

which reconstructs the input from hidden representation. The reconstruction loss of an autoencoder is defined as the squared error between the input and output given by

(1)

Autoencoders leverage reconstruction error as an anomaly score where data points with significantly high errors are considered to be anomalies.

3.4.2 Variational Autoencoders (VAE):

Variational autoencoder (VAE) [14] are generative analogues to the standard deterministic autoencoder. VAE impose constraint while inferring latent variable . The hidden latent codes produced by encoder is constrained to follow prior data distribution . The core idea of VAE is to infer from using Variational Inference (VI) technique given by

(2)

In order to optimize the Kullback–Leibler (KL) divergence, a simple reparameterization trick is applied; instead of the encoder embedding a real-valued vector, it creates a vector of means

and a vector of standard deviations

. Now a new sample that replicates the data distribution can be generated from learned parameters (,) and input this latent representation through the decoder

to reconstruct the original group observations. VAE utilizes reconstruction probabilities 

[3] or reconstruction error to compute anomaly scores.

3.4.3 Adversarial Autoencoders (AAE):

One of the main limitations of VAE is lack of closed form analytical solution for integral of the KL divergence term except for few distributions. Adversarial autoencoders (AAE) [19] avoid using the KL divergence by adopting adversarial learning, to learn broader set of distributions as priors for the latent code. The training procedure for this architecture is performed using an adversarial autoencoder consisting of encoder and decoder . Firstly a latent representation is created according to generator network ,and the decoder reconstructs the input from . The weights of encoder and decoder are updated by backpropogating the reconstruction loss between and . Secondly the discriminator receives distributed as and sampled from the true prior to compute the score assigned to each ( and

). The loss incurred is minimized by backpropagating through the discriminator to update its weights. The loss function for autoencoder (or generator)

is composed of the reconstruction error along with the loss for discriminator where

(3)

where is the minibatch size while represents the latent code generated by encoder and is a sample from the true prior .

4 Problem and Model Formulation

4.0.1 Problem Definition:

Suppose we observe a set of groups where the th group contains observations with

(4)

where the total number of individual observations is .

In GAD, the behavior or properties of the th group is captured by a characterization function denoted by where is the dimensionality on the transformed feature space. After a characterization function is applied to a training dataset, group information is combined using an aggregation function . A group reference is composition of characterization and aggregation functions on the input groups with

(5)

Then a distance metric is applied to measure the deviation of a particular group from the group reference function. The distance score quantifies the deviance of the th group from the expected group pattern where larger values are associated with more anomalous groups. Group anomalies are effectively detected when characterization function and aggregation function respectively capture properties of group distributions and appropriately combine information into a group reference. For example in an variational autoencoder setting, an encoder function characterizes mean and standard deviation of group distributions with for . Obtaining the group reference using an aggregation function in deep generative models is more challenging where VAE and AAE are further explained in Algorithm 1.

Input :  Groups where
Output : Group anomaly scores S for input groups
1 Train AAE and VAE to obtain encoder and decoder on inputs begin
2       switch C do
3             case (VAE) do
4                   for (m = 1 to M) do
5                        
6                   end for
7                  ) draw a sample from
8             end case
9            case (AAE) do
10                   draw a random latent representation
11             end case
12            reconstruct sample using decoder for (m = 1 to M) do
13                   compute the score
14             end for
15            sort scores in descending order S= groups that are furthest from are more anomalous.
16       end switch
17      return S
18 end
19
Algorithm 1 Group anomaly detection using deep generative models

4.1 Training the model

The variational and adversarial autoencoder are trained according to the objective function given in Equation  (2), (3) respectively. The objective functions of DGMs are optimized using standard backpropogation algorithm. Given known group memberships, AAE is fully trained on input groups to obtain a representative group reference from Equation 5. While in case of VAE, is obtained by drawing samples using mean and standard deviation parameters that are inferred using VAE as illustrated in Algorithm 1.

4.2 Predicting with the model

In order to identify group anomalies, the distance of a group from the group reference is computed. The output scores are sorted according to descending order where groups that are furthest from are considered anomalous. One convenient property of DGMs is that the anomaly detector will be inductive, i.e. it can generalize to unseen data points. One can interpret the model as learning a robust representation of group distribution. An appropriate characterization allows for the accurate detection where any unseen observations either lie within the reference group manifold or they are deviate from the expected group pattern.

5 Experimental setup

In this section we show the empirical effectiveness of deep generative models over the state-of-the-art methods on real-world data. Our primary focus will be on non-trivial image datasets, although our method is applicable in any context where autoencoders are useful e.g. speech, text.

5.1 Methods compared

We compare our proposed technique using deep generative models (DGMs) with the following state-of-the art methods for group anomaly detection:

  • Mixture of Gaussian Mixture Model (MGMM)

    , as per [29].

  • One-Class Support Measure Machines (OCSMM), as per [20].

  • One-Class Support Vector Machines (OCSVM)

    , as per [24].

  • Variational Autoencoder (VAE) [9], as per Equation (2).

  • Adversarial Autoencoder (AAE) [19], as per Equation (3).

We used Keras 

[5]

, TensorFlow

[2] for the implementation of AAE and VAE 222https://github.com/raghavchalapathy/gad. MGM 333https://www.cs.cmu.edu/~lxiong/gad/gad.html, OCSMM 444https://github.com/jorjasso/SMDD-group-anomaly-detection and OCSVM 555 https://github.com/cjlin1/libsvm are implemented publicly available code

5.2 Datasets

We compare all methods on the following datasets:

  • cifar-10 [16] consisting of color images over 10 classes with 6000 images per class.

  • scene images from different categories following Xiong et al.  [30].

The real-world data experiments using cifar-10 and scene data are visually summarized in Figure 1 .

5.3 Parameter Selection

We now briefly discuss the model and parameter selection for applying techniques in GAD applications. A pre-processing stage is required for state-of-the-art GAD methods when dealing with images where feature extraction methods such as SIFT

[18] or HOG [7] represent images as a collection of visual features. In MGM, the number of regular group behaviors and number of Gaussian mixtures are selected using information criteria. The kernel bandwidth smoothing parameter in OCSMM [20] is chosen as for all and where represents the th random vector in the th group. In addition, the parameter for expected proportions of anomalies in OCSMM and OCSVM is set to the true value in the respective datasets however this is not required for other techniques.

When applying VAE and AAE, there are four existing network parameters that require careful selection; (a) number of convolutional filters, (b) filter size, (c) strides of convolution operation and (d) activation function. We tuned via grid search additional hyper-parameters, including the number of hidden-layer nodes

, and regularization within range . The learning drop-out rates and regularization parameter

were sampled from a uniform distribution in the range

. The embedding and initial weight matrices are all sampled from uniform distribution within range .

6 Experimental results

In this section, we explore a variety of experiments for group anomaly detection. As anomaly detection is an unsupervised learning problem, model evaluation is highly challenging. Since we known the ground truth labels of the group anomalies that are injected into the real-world image datasets. The performance of deep generative models is evaluated against state-of-the-art GAD methods using area under the precision-recall curve (AUPRC) and area under the ROC curve (AUROC) metrics. AUPRC and AUROC quantify the ranking performance of different methods where the former metric is more appropriate under class imbalanced datasets  

[8].

6.1 Synthetic Data: Rotated Gaussian distribution

We generate synthetic dataset where regular behavior consists of bivariate Gaussian samples while anomalous groups have are rotated covariance structure.

More specifically, regular group distributions have correlation while 50 anomalous groups have correlation . The mean vectors are randomly sampled from uniform distributions ,while covariances of group distributions are

(6)

with each group having observations.

Parameter settings: GAD methods are applied on the raw data with various parameter settings. MGM is trained with regular scene types and as the number of Gaussian mixtures. The expected proportion of group anomalies as true proportion in OCSMM and OCSVM is set to = 50/M where or

. In addition, OCSVM is applied by treating each Gaussian distribution as a single high-dimensional observation.

Results: Table 1 illustrates the results of detecting distribution-based group anomalies for different group sizes. For smaller group sizes , state-of-the-art GAD methods achieve a higher performance than deep generative models however for a larger training set with , deep generative models achieve the highest performance. This conveys that deep generative models require larger number of group observations in order to train an appropriate model.

Methods M=550 M=5050
AUPRC AUROC AUPRC AUROC
AAE
VAE
MGM
OCSMM
OCSVM
Table 1: Task results for detecting rotated Gaussian distributions in synthetic datasets, the first two rows contains deep generative models and the later techniques are state-of-the-art GAD methods. The highest performances are shaded in gray.

6.2 Detecting tigers within cat images

Firstly we explore the detection of point-based group anomalies (or image anomalies) by combining 5000 images of cats and 50 images of tigers. The images of tigers were obtained from Pixabay [11] and rescaled to match the image dimension of cats in cifar-10 dataset. From Figure 1, cat images are considered as regular behavior while characteristics of tiger images are point anomalies. The goal is to correctly detect all images of tigers in an unsupervised manner.

Parameter settings: In this experiment, HOG extracts visual features as inputs for GAD methods. MGM is trained with regular cat type and as the number of mixtures. Parameters in OCSMM and OCSVM are set to = 50/5050 and OCSVM is applied with -means (

). For the deep learning models, following the success of the Batch Normalization architecture 

[12] and Exponential Linear Units [6], we have found that convolutional+batch-normalization+elu layers provide a better representation of convolutional filters. Hence, in this experiment the autoencoder of both AAE and VAE adopts four layers of (conv-batch-normalization-elu) in the encoder part and four layers of (conv-batch-normalization-elu) in the decoder portion of the network. AAE network parameters such as (number of filter, filter size, strides) are chosen to be (16,3,1) for first and second layers and (32,3,1) for third and fourth layers of both encoder and decoder layers. The middle hidden layer size is set to be same as rank and the model is trained using Adam [13]

. The decoding layer uses sigmoid function in order to capture the nonlinearity characteristics from latent representations produced by the hidden layer.

6.3 Discovering rotated entities

Secondly we explore the detection of distribution-based group anomalies in terms of a rotated images by examining 5000 images of cats and 50 images of rotated cats. As illustrated in Figure 1, images of rotated cats have anomalous distributions compared to regular images of cats . In this scenario, the goal is to detect all rotated cats in an unsupervised manner.

Parameter settings: In this experiment, HOG extracts visual features for this rotated group anomaly experiment because SIFT features are rotation invariant. MGM is trained with regular cat type and as the number of mixtures while -means () is applied to the SIFT features and then OCSVM is computed with parameters is set to the true proportion of anomalies. For the deep generative models, the network parameters follows similar settings as described in previous experiment of detecting tigers within cats images.

6.4 Detecting cats and dogs

We further investigate the detection of distribution-based group anomalies in terms of a cats with dogs. The constructed dataset consists of 5050 images; 2500 single cats, 2500 single dogs and 50 images of cats and dogs together. The 50 images of cats and dogs together were obtained from Pixabay [11] and rescaled to match the image dimension of cats and dogs present in cifar-10 dataset. Images with a single cat or dog are considered as regular groups while images with both cats and dogs are distributed-based group anomalies. In this scenario, the goal is to detect all images with irregular mixtures of cats and dogs in an unsupervised manner.

Parameter settings: In this experiment, HOG extracts visual features as inputs for GAD methods. MGM is trained with regular cat type and as the number of mixtures while OCSVM is applied with -means (). For the deep generative models, the parameter settings follows setup as described in Section 6.2.

(a) Tigers within cat images from cifar-10 dataset.
(b) Images of cats and dogs within single cat and dog images using cifar-10 dataset.
Figure 2: Top 10 anomalous images are presented from the best deep learning and GAD method. Red boxes around images represent correctly detected group anomalies as shown in (a) and (b). AAE correctly detects all group anomalies in the cifar-10 dataset containing tigers as well as the experiment involving images with cats and dogs. While OCSMM consistently identifies similar cat images as the most anomalous images.

6.5 Detecting stitched scene images

We present results on scene image dataset where 100 images originated from each category “inside city”, “mountain” and “coast”. An additional 66 stitched anomalies contain images with two scene categories. For example, distribution-based group anomalies may represent images with half coast and half city street view. These anomalies are challenging since they have the same local features as regular images however as a collection, they are anomalous.

Parameter settings: State-of-the-art GAD methods utilize SIFT feature extraction for visual image features in this experiment . MGM is trained with regular scene types and Gaussian mixtures while OCSVM is applied with -means (). The scene images are rescaled from dimension to to enable reuse the same architecture followed in previous experiments. The parameter settings for both AAE and VAE follows setup as described in Section 6.2.

(a) Rotated cats amongst regular cats in the cifar-10 dataset.
(b) Stitched Images amongst the scene dataset.
Figure 3: Top 10 anomalous images are presented where red boxes outlining images represent true group anomalies in the given datasets. AAE performs well in (a) however does not effectively detect group anomalies in (b). MGM is unable to detect rotated cats based on extracted HOG features while OSCMM is able to detect group anomalies in the scene dataset.

6.6 Results Summary and Discussion

Table  2 summarizes the detection performance of deep generative models and existing GAD methods on a variety of datasets. AAE achieves the highest detection performance in experiments (except for scene data) as illustrated in Figure 2 and  3. Similar to the results in the synthetic dataset, deep generative models have a significantly worse performance when the group size is small such as in the scene dataset with compared to groups in other experiments. DGMs are effective in detecting group anomalies for larger training set.

Methods Tigers Rotated Cats Cats and Dogs Scene
AUPRC AUROC AUPRC AUROC AUPRC AUROC AUPRC AUROC
AAE 0.9449 0.5906
VAE
MGM 0.9906 0.5377 0.8835 0.6639
OCSMM 0.9930 0.5876
OCSVM 0.9909 0.5474 0.9916 0.5549 0.8650 0.5733
Table 2: Summary of results for various data experiments where first two rows contains deep generative models and the later techniques are state-of-the-art GAD methods. The best performances are shaded in gray.

Comparison of training times: We add a final remark about applying the proposed deep generative models on GAD problems in terms of computational time and training efficiency. For example, including the time taken to calculate SIFT features on the small-scale scene dataset, MGMM takes 42.8 seconds for training, 3.74 minutes to train OCSMM and 27.9 seconds for OCSVM. In comparison, the computational times for our AAE and VAE are 6.5 minutes and 8.5 minutes respectively. All the experiments involving deep learning models were conducted on a MacBook Pro equipped with an Intel Core i7 at 2.2 GHz, 16 GB of RAM (DDR3 1600 MHz). The ability to leverage recent advances in deep learning as part of our optimization (e.g. training models on a GPU) is a salient feature of our approach. We also note that while MGM and OCSMM method are faster to train on small-scale datasets, they suffer from at least complexity for the total number of observations . It is plausible that one could leverage recent advances in fast approximations of kernel methods [17] for OCSMM and studying these would be of interest in future work.

7 Conclusion

Group anomaly detection is a challenging area of research especially when dealing with complex group distributions such as image data. In order to detect group anomalies in various image applications, we clearly formulate deep generative models (DGMs) for detecting distribution-based group anomalies. DGMs outperform state-of-the-art GAD techniques in many experiments involving both synthetic and real-world image datasets. However, DGMs also require a large number of group observations for model training. To the best of our knowledge, this is the first paper to formulate and apply deep generative models to the problem of detecting group anomalies. A future direction for research involves using recurrent neural networks to detect temporal changes in a group of time series.

References