Skip to content
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

How can I get hidden layer representation of the given data #169

Open
ohuole233 opened this issue Sep 10, 2016 · 1 comment
Open

How can I get hidden layer representation of the given data #169

ohuole233 opened this issue Sep 10, 2016 · 1 comment

Comments

@ohuole233
Copy link

When deep belief network is implemented for representation learning, I'm confused about the representation of hidden layers for the original data matrix.
The method sigmoid_layers[-1].output seems doesn't work with no representation for the matrix acquired except 0.
Has anybody encountered such confusion?

@tingjianlau
Copy link

tingjianlau commented Oct 12, 2016

In DBN.py, I add the extract_features() to get the output of the rbms.

def extract_features(self, aim_set_x, batch_size):
        n_aim_batches = aim_set_x.get_value(borrow=True).shape[0]
        n_aim_batches //= batch_size
        index = T.lscalar('index')  # index to a [mini]batch

         # extract the feature
        extract_features_i = theano.function(
            [index],
            self.sigmoid_layers[-1].output,
            givens={
                self.x: aim_set_x[
                    index * batch_size: (index + 1) * batch_size
                ]
            }
        )      
        return [extract_features_i(i) for i in range(n_aim_batches)]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants