yajiemiao / pdnn

PDNN: A Python Toolkit for Deep Learning. http://www.cs.cmu.edu/~ymiao/pdnntk.html
Apache License 2.0
224 stars 105 forks source link

run_Extract_Feats.py for stacked RBMs? #1

Closed pfedichev closed 9 years ago

pfedichev commented 9 years ago

run_Extract_Feats.py appears to work for DNN or CNN only. Don't ask why, but I'd need to run stacked RBMs example, trained the network but failed to extract features using run_Extract_Feats.py. Am I missing something or isn't this just not implemented?

ghost commented 9 years ago

Currently run_Extract_Feats.py only supports DNN and CNN. But you can make it work with RBM/SDA simply by converting RBM/SDA models into DNN. Suppose that you are working with the MNIST example and your RBM model is "rbm.param". Then you can get the corresponding DNN model by:

python $pdnndir/cmds/run_DNN.py --train-data "train.pickle.gz" \ --valid-data "valid.pickle.gz" \ --nnet-spec "784:1024:1024:10" --lrate "C:0.0:0" --wdir ./ \ --ptr-file rbm.param --ptr-layer-number 2 \ --param-output-file dnn.param --cfg-output-file dnn.cfg

Here we set the learning rate to 0, so that NO fine-tuning will be performed. Now we can use dnn.param and dnn.cfg to do feature extraction with run_Extract_Feats.py

ghost commented 9 years ago

We just added the example examples/mnist_rbm/run.sh to demonstrate how to train a RBM model, use the RBM as the feature extractor and train the DNN model with features generated with the RBM.