-
Notifications
You must be signed in to change notification settings - Fork 221
Support for autoencoders in greedy layer-wise pre-training #50
Conversation
OK, this is looking promising! I got it to work with minor changes after merging the latest code. I'd suggest we iterate on the external API first. How does this look to you:
Things like Thoughts welcome! |
My two cents: Autoencoders can be used to compress/denoise stuff, a nice "transform" operation in sklearn terms. The transformed output (top layer inputs * weights) can then be thrown to any classifier/regressor to learn on top of it - which should be pretty cool. So I think it has to be a seperate module/class whatever, and if you want to mix with the mlps you can do as in the example - if not, you can use them let's say in pipeline with any classifier/regressor on top, which should be nice. I am not sure the MLP class should have any knowledge of this. |
The problem I noticed is that autoencoders only seem to support |
Based on @ssamot's comment, I started a branch |
…d/refactored version of @leconteur's prototype: #50
I agree with @ssamot that the autoencoder should implements the transform interface of sklearn. However, I think it is a good idea that the mlp class could take a PretrainedLayer in the constructor. The transform could probably be implemented by using the "encode" method of the pylearn2 autoencoder class that form the last layer of the network. |
I'm considering it now... One problem I see currently with |
I don't think we need serialization at first. However, all that is needed for a pretrained layer is to pass it the pylearn2 layer in the constructor. The reason I think is important is to facilitate the fine-tuning of a layer that could have been trained in a variety of ways. They are also already implemented in pylearn2. If you do want to implement them, I think it should be done in a way similar to this: The autoencoder should have a method that returns a list of its autoencoder layers wrapped in a sknn layer with a type 'pretrained'. The mlp should then have a condition in its create_layer method that calls the right pylearn2 constructor. I do understand however that the use case where I need this features is not very similar to the scikit-learn api and use case. The main problem I have is that this kind of algorithm is hard to fit in a scikit-learn pipeline paradigm. |
About the features in the auto-encoder, do your final neural networks also use sigmoid and tanh? ReLU doesn't seem to be supported out of the box, but could be added... otherwise it seems like you'd be better off training a full MLP in an unsupervised style. |
I don't think I'll need ReLU activation. My use case is very similar to the example I pushed, except that the pretraining is done on another dataset. Sorry about the other changes, I seem to have misunderstood some details about pull-request. |
No problem about the Pull Request. All changes in that branch are automatically posted. We won't merge this PR since it contains your IDE files too :-) |
This pull request presents a prototype to include Autoencoders support in scikit-neuralnetwork. It does not include tests but does include a working example.