Extracting DBN last hidden layer, Theano, Python
<p>I am new to Theano and I have been searching for this question about 2 months. I am using the code provided in this site: <a href="http://deeplearning.net/tutorial/DBN.html" rel="nofollow">http://deeplearning.net/tutorial/DBN.html</a></p>

<p>I have a 4 layer Deep Belief Network, actually with 2 hidden layers. 
As far as I could find out, this code is classifying my data set (I have to provide labels). But I want to "reduce the dimension of my inputs" with this algorithm. So I have to extract the value of the neurons of the last hidden layer. But I can't.</p>

<p>How can I do this?</p>

<p>Thank you in advance</p>

<p>DBM is constructed in layer wise of multiple RBM. quick review to the code in the provided link you should look to the appended layer in the DBM and print the output result of this layer when you are providing the input in these following models. </p>

<pre><code>    sigmoid_layer = HiddenLayer(rng=numpy_rng,
                                input=layer_input,
                                n_in=input_size,
                                n_out=hidden_layers_sizes[i],
                                activation=T.nnet.sigmoid)

    self.sigmoid_layers.append(sigmoid_layer)

    rbm_layer = RBM(numpy_rng=numpy_rng,
                    theano_rng=theano_rng,
                    input=layer_input,
                    n_visible=input_size,
                    n_hidden=hidden_layers_sizes[i],
                    W=sigmoid_layer.W,
                    hbias=sigmoid_layer.b)

    self.rbm_layers.append(rbm_layer)
</code></pre>

python theano