This repository contains the official implementation for the paper q-Space Novelty Detection with Variational Autoencoders.
- python 3
- theano
- lasagne
- numpy
- scipy
- matlab
Distance- and density-based methods are implemented in matlab. Other methods are implemented in python.
To use one of the proposed novelty detection methods with your data you should:
- implement data loading methods in model/Data.py
- train a model on your data
- run one of the proposed methods:
# test_data = ...
nd = NoveltyDetection(model=1)
res = nd.compute_fast_novelty_scores(test_data)
# ...
for matlab methods, data should be saved in 'mat' format first:
# normal_data = ..., test_data = ...
nd = NoveltyDetection(model=1)
latent_normal_data = nd.encode(normal_data)
latent_test_data = nd.encode(test_data)
nd.save_to_mat(latent_normal_data, "normal_data_path")
nd.save_to_mat(latent_test_data, "test_data_path")
then you can run a matlab code:
test_data = load('test_data_path', 'data');
normal_data = load('normal_data_path', 'data');
novelty_score = compute_novelty_score(normal_data, test_data, 'metric', 'euclidean', 'use_gpu', true);
...