-
Notifications
You must be signed in to change notification settings - Fork 19.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add autoencoder and denoising autoencoder #180
Conversation
This is certainly a way of doing this that fits with the existing structures more nicely. However, I think it limits the usefulness in the long term. Some drawbacks I see with this as opposed to the version in #155
|
The benefits I see here are that:
|
I will take some time to review both approaches asap. The way I see it, returning the hidden representation or the reconstruction should not depend on outside rules, it should be self-contained. We could set a flag on the Autoencoder (eg. constructor argument, or parameter that you can set at a later time) to get it to return either the hidden representation or the reconstruction in In the layer API, you should only ever call |
This sounds reasonable. I can drop these changes in early tomorrow. |
A flag to switch the output sounds like a good solution. If we can figure
|
@phreeza : So I really want to get in something that does allow for the layers to be customizable. This is proving a little tricky though as the graph connectivity needs to be handled. I am working on it. |
I have updated my implementation to allow for any type of layer to be fed into the autoencoder. eg: autoencoder.add(AutoEncoder(encoder=Dense(32, 16, activation='tanh')
, decoder=Dense(16, 32, activation='tanh')
, output_reconstruction=False, tie_weights=True)) |
One question regarding extending this to deep autoencoders: do I have to do something special to do greedy layer-wise training? I have implemented this feature as well by simply passing in a list of encoders/decoders. |
This is great. The implementation is neat, this is definitely good solution to autoencoders within the Keras framework. Merging this now! : ) Next, documentation will be needed now that this is part of Keras... |
I think that's fine for now. But we can try new things in the future... |
I think there are some issues with the test_autoencoder script. It seems to confuse the error (higher is worse) with a score (higher is better). Practically, this means the "percent improvement" reported is technically the percent decline in performance. I don't have too much time to look into this now or fix it, but I believe it should be addressed. |
You are right. It's not clear to me what the logical expected behavior would be here --should we really expect that autoencoding would make the learning problem easier in this case? In any case, it needs to be made clear in the tests that performance is in fact declining with this setup. Having an example where autoencoding does help with a task would be neat. |
Yup. I misinterpreted that one. Will mull it over and see if the example is erroneous or its just a case of not having enough data/training enough. Ill run something by tomorrow. |
Why is weight tying removed in AutoEncoder? What's the alternative? |
Co-authored-by: Haifeng Jin <haifeng-jin@users.noreply.github.com>
Co-authored-by: Haifeng Jin <haifeng-jin@users.noreply.github.com>
This implementation creates a base autoencoder class that should be inherited for all other implementations of autoencoders. Since we have added a get_hidden() method this can be used later on when we start stacking autoencoders. I.e. we can do something along the lines of:
A denoising autoencoder has also been added to demo how to inherit from AutoEncoder.
I have tried to be consistent with your coding style. Let me know if there are any issues.