ludwig icon indicating copy to clipboard operation
ludwig copied to clipboard

GAN and AutoEncoder

Open Kantshun opened this issue 6 years ago • 5 comments

Is there anyway I can implement GAN and AutoEncoder with ludwig? could anyone provide some examples? I have no idea how I can access the outputs of middle layers nor fixed the weights of some layers while training the model. It seems that ludwig is not friendly to neither GAN nor AutoEncoder, which are quite important in some applications.

Kantshun avatar Sep 24 '19 03:09 Kantshun

@Kantshun I don't think there are easy ways to do either GAN or autoencoder with Ludwig as things are right now.

msaisumanth avatar Sep 25 '19 17:09 msaisumanth

@Kantshun for GANs at the moment there is no specific support, but regarding autoencoders, it depends on the type of data you want to autoencoder: any datatype that is supported for both input and output features. The only caveat is that currently Ludwig doesn't support multiple features to be defined with the same column name, so you would have to copy a column, change its name and then write a model accordingly. For instance, for text the data it would look like:

text_input,text_output
hello world,hello world
my name is,my name is
...

And the model definition would look like:

input_features:
  -
    name: text_input
    type: text
output_features:
  -
    name: text_output
    type: text

Hope this help you.

w4nderlust avatar Sep 27 '19 12:09 w4nderlust

@w4nderlust your method can train an autoencoder, but that's not enough. in my application, i need to use encoder and decoder separately, I have no idea how to split a ludwig model into two sub model that represent encoder and decoder.

Kantshun avatar Oct 05 '19 01:10 Kantshun

@Kantshun I understand the need. For the encoder part, you can use the collect activations command for obtaining the latent representations, but at the moment there is no way to actually provide a latent representation for the decoder to perform the generation. Given TensorFlow's fixed graph structure is currently a bit difficult to change Ludwig to accomodate your usecase, but once we move to TensorFlow 2 it will become much easier and we will try to address this usecase. Consider it may take a little while for that to happen as we have currently other priorities for v0.3, so my best estimate at the moment is that it will happen by v0.4.

w4nderlust avatar Oct 05 '19 02:10 w4nderlust

Hey, just wanted to ask, if there is already a solution. I have an imbalanced dataset of audio signals with two classes and would like to try an autoencoder with an adjustable threshold to do anomaly detection on the larger part of the datset...

Thanks

FredS1000 avatar Apr 09 '24 11:04 FredS1000