2
$\begingroup$

I have some limited experience with MLPs and CNNs. I am working on a project where I've used a CNN to classify "images" into two classes, 0 and 1. I say "images" as they are not actually images in the traditional sense, rather we are encoding a string from a limited alphabet, such that each character has a one-hot encoded row in the "image". For example, we are using this for a bioinformatics application, so with the alphabet {A, C, G, T} the sequence "ACGTCCAGCTACTTTACGG" would be:

enter image description here

All "images" are 4x26. I used a CNN to classify pairs of "images" (either using two channels, i.e. 2x4x26 or concatenating two representations as 8x26) according to our criteria with good results. The main idea is for the network to learn how 2 sequences interact, so there are particular patterns that make sense. If we want to detect a reverse complement for example, then the network should learn that A-T and G-C pairs are important. For this particular example, if the interaction is high/probable, the assigned label is 1, otherwise 0.

However, now we want to go one step further and have a model that is able to generate "images" (sequences) that respect the same constraints as the classification problem. To solve this, I looked at Generative Adversarial Networks as the tool to perform the generation, thinking that maybe I could adapt the model from the classification to work as the discriminator. I've looked at the "simpler" models such as DCGAN and GAN, with implementations from https://github.com/eriklindernoren/Keras-GAN, as I've never studied or used a GAN before.

Say that we want to generate pairs that are supposed to interact, or with the label 1 from before. I've adapted the DCGAN model to train on our 1-labelled encodings and tried different variations for the discriminator and generator, keeping in mind rules of thumb for stability. However, I can't get the model to learn anything significant. For example, I am trying to make the network learn the simple concept of reverse complement, mentioned above (expectation: learn to produce a pair with high interaction, from noise). Initially the accuracy for the discriminator is low, but after a few thousand epochs it increases drastically (very close to 100%, and the generator loss is huge, which apparently is a good thing, as the two models "compete" against each other?). However, the generated samples do not make any sense.

I suspect that the generator learns the one-hot encoding above - since early generator output is just noise, it probably learns something like "a single 1 per column is good", but not the more high level relation between the 1s and 0s. The discriminator probably is able to tell that the early generated outputs are garbage as there are 1s all over the place, but perhaps at some point the generator can match the one-hot encoding and thus the discriminator decides that is not a fake. This would explain the high accuracy, despite the sequences not making sense.

I am not sure of this is the case or not, or if it makes sense at all (I've just started reading about GANs yesterday). Is there a way to capture the high level features of the dataset? I am not interested in just generating something that looks like a real encoding, I'd like to generate something that follows the encoding but also exhibits patterns from the original data.

I was thinking that maybe pretraining the discriminator would be a good idea, because it would then be able to discern between real-looking encodings for both the 0 and 1 classes. However, the pretraining idea seems frowned upon.

I'd appreciate any ideas and advice. Thanks!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.