A new deep learning algorithm for performing anomaly detection and multi-class classification with explainability using counterfactuals is described. The system is a Variational Autoencoder (VAE) with a modified loss function and new methods for counterfactual identification. An additional hinge-loss term is added to VAE training. This enables convenient synthetic data generation and allows straightforward construction of multi-class counterfactuals. Counterfactuals are synthetic data generated to explain system decisions by answering the question: “If this data was not anomalous or was in another class, what modifications would need to be made?” To determine counterfactuals, a path is determined through the embedding space via adversarial attack-like techniques to minimize reconstruction error, with the restriction of minimally altering the number of columns changed. Large changes are allowed, unlike adversarial attack approaches, so changes are isolated and easily visible. Anomaly detection is performed by modifying a result to lower its anomalousness. Classification changes are performed by modifying the data to another class. Multi-class classification is performed on the embedding space of the VAE via an attached linear support vector machine (SVM). By adding the hinge-loss term to the VAE embedding training as well as the SVM, the embedding is modified to prefer class separation without being informed of the specific class labels. This causes the classes in the embedding space to be separated by hyperplanes, making counterfactual generation convenient and SVM classification accurate. Accuracy is shown to be comparable to other deep learners. Approaches to accommodating the image and time-series data are discussed.
|