Coder Social home page Coder Social logo

adversarialconditionalvae's Introduction

Adversarially Censored Conditional Variational Autoencoders

This is an implementation of adversarially censored conditional variational autoencoder (cVAE) models for learning invariant latent spaces. Conventional cVAE model learning is performed within an adversarial training setting to monitor and/or censor nuisance-specific leakage in the learned latent space. Implementation is in Python using Keras with Tensorflow backend. It was implemented to be used with electroencephalographic (EEG) data from different subjects. This is a re-implementation of presented work (see below citation) with arbitrary encoder-decoder architectures.

Usage

An example execution is as follows:

from AdversarialcVAE import AdversarialcVAE

net = AdversarialcVAE(chans = ..., samples = ..., n_latent = ..., n_nuisance = ..., n_kernels = ..., adversarial = ..., lam = ...)

net.train(train_set, validation_set, log = ..., epochs = ..., batch_size = ...)

Parameter n_latent defines the latent space dimensionality, n_nuisance defines the nuisance variable dimensionality (i.e., the condition and the adversary output), and n_kernels define the number of convolutional kernel filters within the encoder and decoder which both have arbitrary structures for now. Boolean parameter adversarial = True trains the cVAE via adversarial censoring. If False, then an adjacent adversary network is simply trained to monitor nuisance-specific leakage in the latent representations. Parameter lam indicates the adversarial regularization weight embedded in the total loss function.

To use the train function, both train_set and validation_set should be three-element tuples (i.e., x_train, y_train, s_train = train_set). Here, the first element x_train is the EEG data of size (num_observations, num_channels, num_timesamples, 1), y_train are the one-hot encoded class labels (e.g., for binary labels will have a size (num_observations, 2)), and s_train are the one-hot encoded nuisance labels used for censoring (e.g., for 10-class nuisance labels will have size (num_observations, 10)). Variable log indicates the directory string to save the log files during training.

Paper Citation

If you use this code in your research and find it helpful, please cite the following paper:

Ozan Ozdenizci, Ye Wang, Toshiaki Koike-Akino, Deniz Erdogmus. "Transfer learning in brain-computer interfaces with adversarial variational autoencoders". 9th International IEEE/EMBS Conference on Neural Engineering (NER), 2019. https://dx.doi.org/10.1109/NER.2019.8716897

adversarialconditionalvae's People

Contributors

oozdenizci avatar

Stargazers

Lei Li avatar Andac Demir avatar  avatar

Watchers

 avatar

Forkers

shameelfaraz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.