{
  "id": 4478,
  "title": "GaussianBinaryRBM Question",
  "url": "/competitions/challenges-in-representation-learning-the-black-box-learning-challenge/discussion/4478",
  "author_name": "",
  "post_date": "2013-05-01T19:29:53.483Z",
  "votes": null,
  "comment_count": 14,
  "views": 4592,
  "content": "<p>Hi,</p>\r\n<p>Which of the following methods in GaussianBinaryRBM class is used to get the output probability of the classes?</p>\r\n<p>a) score</p>\r\n<p>b) P_H_given_V</p>\r\n<p>c) mean_h_given_V</p>\r\n<p>d) mean_v_given_h</p>\r\n<p>e) free_energy_given_v</p>\r\n<p>f) free_energy</p>\r\n<p>I am trying to find the equivalent of fprop in mlp.py so that I can use similar code to make a submission</p>",
  "messages": [
    {
      "id": "23766",
      "postDate": "05/01/2013 19:29:53",
      "content": "<p>Hi,</p>\r\n<p>Which of the following methods in GaussianBinaryRBM class is used to get the output probability of the classes?</p>\r\n<p>a) score</p>\r\n<p>b) P_H_given_V</p>\r\n<p>c) mean_h_given_V</p>\r\n<p>d) mean_v_given_h</p>\r\n<p>e) free_energy_given_v</p>\r\n<p>f) free_energy</p>\r\n<p>I am trying to find the equivalent of fprop in mlp.py so that I can use similar code to make a submission</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23767",
      "postDate": "05/01/2013 19:34:40",
      "content": "<p>The GaussianBinaryRBM does not model classes. It models input pixels using latent random variables that help explain the pixels.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23768",
      "postDate": "05/01/2013 19:42:07",
      "content": "<p>Thanks -</p>\r\n<p>I tried:</p>\r\n<p>X = model.get_input_space().make_batch_theano()<br>\r\nY = model.score (X)</p>\r\n<p>&nbsp;</p>\r\n<p>and Y was indeed a 10000 * 9 matrix - indicating there were predictions -</p>\r\n<p>Is there a way I can tweak this piece to get multi-class predictions (Sorry to bother - if you can even point me to useful literature, it would help)</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23769",
      "postDate": "05/01/2013 19:44:07",
      "content": "<p>Maybe you set the RBM to have 9 hidden units? Here is my lab's tutorial on RBMs:&nbsp;http://deeplearning.net/tutorial/rbm.html</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23770",
      "postDate": "05/01/2013 19:52:08",
      "content": "<p>Thanks a ton - Yes, I had number of hidden units = number of outputs.</p>\r\n<p>This just models the pixels as binaries correct - no way to model classes using these. I will give up this approach.</p>\r\n<p>&nbsp;</p>\r\n<p>Thanks</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23771",
      "postDate": "05/01/2013 19:56:14",
      "content": "<p>It models the pixels as gaussian, and tries to explain them with binary latent factors. You can use the binary latent factors as features for predicting the class labels. Here's an example paper:&nbsp;http://jmlr.csail.mit.edu/proceedings/papers/v15/coates11a.html</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23772",
      "postDate": "05/01/2013 19:59:44",
      "content": "<p>Thanks - last question for the day.</p>\r\n<p>What method in GaussianBinaryRBM class returns the latent factors?</p>\r\n<p>I will try out the method in Andrew's paper</p>\r\n<p>Thanks a ton</p>\r\n<p>Kiran</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23776",
      "postDate": "05/01/2013 21:23:46",
      "content": "<p>You can compute the conditional expectation of them using mean_H_given_V.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23813",
      "postDate": "05/02/2013 15:23:31",
      "content": "<p>Thanks a ton as usual Ian!</p>\r\n<p>I have got mean_h_given_v -&gt; for 1000 hidden nodes. These are the same as latent factors. Correct?</p>\r\n<p><br>\r\nThanks<br>\r\n<br>\r\n</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23817",
      "postDate": "05/02/2013 15:45:49",
      "content": "<p>Well, there are lots of things you can do with the latent variables. But taking their conditional expectation is what people usually do for feature extraction. So yeah, you're doing the right thing.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23822",
      "postDate": "05/02/2013 16:36:42",
      "content": "<p>It works.</p>\r\n<p>but in deep_trainer.py, changing n_hid in the 3 functions (get_denoising_autoencoder,&nbsp; get_grbm,get_autoencoder ) to any value other than n_output results in an error</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23823",
      "postDate": "05/02/2013 16:37:44",
      "content": "<p>What is n_output, the number of classes? What is the error?</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23824",
      "postDate": "05/02/2013 16:39:36",
      "content": "<p>It shows the follwoing error when we make nhid to 1000 or any arbitrary value</p>\r\n<p>only value that works is the default nhid = n_output</p>\r\n<p>&nbsp;</p>\r\n<p>Traceback (most recent call last):<br>\r\n&nbsp; File &quot;/home/kirana/pylearn2/pylearn2/scripts/tutorials/deep_trainer/run_deep_trainer.py&quot;, line 282, in &lt;module&gt;<br>\r\n&nbsp;&nbsp;&nbsp; main()<br>\r\n&nbsp; File &quot;/home/kirana/pylearn2/pylearn2/scripts/tutorials/deep_trainer/run_deep_trainer.py&quot;, line 268, in main<br>\r\n&nbsp;&nbsp;&nbsp; layer_trainer.main_loop()<br>\r\n&nbsp; File &quot;/usr/local/lib/python2.7/dist-packages/pylearn2-0.1dev-py2.7.egg/pylearn2/train.py&quot;, line 116, in main_loop<br>\r\n&nbsp;&nbsp;&nbsp; self.run_callbacks_and_monitoring()<br>\r\n&nbsp; File &quot;/usr/local/lib/python2.7/dist-packages/pylearn2-0.1dev-py2.7.egg/pylearn2/train.py&quot;, line 137, in run_callbacks_and_monitoring<br>\r\n&nbsp;&nbsp;&nbsp; self.model.monitor()<br>\r\n&nbsp; File &quot;/usr/local/lib/python2.7/dist-packages/pylearn2-0.1dev-py2.7.egg/pylearn2/monitor.py&quot;, line 195, in __call__<br>\r\n&nbsp;&nbsp;&nbsp; a(X)<br>\r\n&nbsp; File &quot;/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py&quot;, line 586, in __call__<br>\r\n&nbsp;&nbsp;&nbsp; gof.vm.raise_with_op(self.fn.nodes[self.fn.position_of_error])<br>\r\n&nbsp; File &quot;/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py&quot;, line 580, in __call__<br>\r\n&nbsp;&nbsp;&nbsp; outputs = self.fn()<br>\r\nValueError: Shape mismatch: x has 1000 cols (and 10 rows) but y has 10 rows (and 1000 cols)<br>\r\n<br>\r\n<br>\r\n</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23825",
      "postDate": "05/02/2013 16:41:22",
      "content": "<p>I've asked the author of the tutorial to look into it.</p>",
      "rawMarkdown": "",
      "votes": null
    },
    {
      "id": "23828",
      "postDate": "05/02/2013 17:52:19",
      "content": "<p>When trying to stack models, you need to make sure the shape of inputs and outputs from subsequent layers are consistent. That means, the outputs from layer i should have the same shape of inputs for layer i&#43;1. It looks like you have a problem over there.</p>",
      "rawMarkdown": "",
      "votes": null
    }
  ],
  "comments": [
    {
      "id": 23767,
      "author_name": "iangoodfellow",
      "author_url": "",
      "post_date": "05/01/2013 19:34:40",
      "content": "<p>The GaussianBinaryRBM does not model classes. It models input pixels using latent random variables that help explain the pixels.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23768,
      "author_name": "rkirana",
      "author_url": "",
      "post_date": "05/01/2013 19:42:07",
      "content": "<p>Thanks -</p>\r\n<p>I tried:</p>\r\n<p>X = model.get_input_space().make_batch_theano()<br>\r\nY = model.score (X)</p>\r\n<p>&nbsp;</p>\r\n<p>and Y was indeed a 10000 * 9 matrix - indicating there were predictions -</p>\r\n<p>Is there a way I can tweak this piece to get multi-class predictions (Sorry to bother - if you can even point me to useful literature, it would help)</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23769,
      "author_name": "iangoodfellow",
      "author_url": "",
      "post_date": "05/01/2013 19:44:07",
      "content": "<p>Maybe you set the RBM to have 9 hidden units? Here is my lab's tutorial on RBMs:&nbsp;http://deeplearning.net/tutorial/rbm.html</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23770,
      "author_name": "rkirana",
      "author_url": "",
      "post_date": "05/01/2013 19:52:08",
      "content": "<p>Thanks a ton - Yes, I had number of hidden units = number of outputs.</p>\r\n<p>This just models the pixels as binaries correct - no way to model classes using these. I will give up this approach.</p>\r\n<p>&nbsp;</p>\r\n<p>Thanks</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23771,
      "author_name": "iangoodfellow",
      "author_url": "",
      "post_date": "05/01/2013 19:56:14",
      "content": "<p>It models the pixels as gaussian, and tries to explain them with binary latent factors. You can use the binary latent factors as features for predicting the class labels. Here's an example paper:&nbsp;http://jmlr.csail.mit.edu/proceedings/papers/v15/coates11a.html</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23772,
      "author_name": "rkirana",
      "author_url": "",
      "post_date": "05/01/2013 19:59:44",
      "content": "<p>Thanks - last question for the day.</p>\r\n<p>What method in GaussianBinaryRBM class returns the latent factors?</p>\r\n<p>I will try out the method in Andrew's paper</p>\r\n<p>Thanks a ton</p>\r\n<p>Kiran</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23776,
      "author_name": "iangoodfellow",
      "author_url": "",
      "post_date": "05/01/2013 21:23:46",
      "content": "<p>You can compute the conditional expectation of them using mean_H_given_V.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23813,
      "author_name": "rkirana",
      "author_url": "",
      "post_date": "05/02/2013 15:23:31",
      "content": "<p>Thanks a ton as usual Ian!</p>\r\n<p>I have got mean_h_given_v -&gt; for 1000 hidden nodes. These are the same as latent factors. Correct?</p>\r\n<p><br>\r\nThanks<br>\r\n<br>\r\n</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23817,
      "author_name": "iangoodfellow",
      "author_url": "",
      "post_date": "05/02/2013 15:45:49",
      "content": "<p>Well, there are lots of things you can do with the latent variables. But taking their conditional expectation is what people usually do for feature extraction. So yeah, you're doing the right thing.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23822,
      "author_name": "rkirana",
      "author_url": "",
      "post_date": "05/02/2013 16:36:42",
      "content": "<p>It works.</p>\r\n<p>but in deep_trainer.py, changing n_hid in the 3 functions (get_denoising_autoencoder,&nbsp; get_grbm,get_autoencoder ) to any value other than n_output results in an error</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23823,
      "author_name": "iangoodfellow",
      "author_url": "",
      "post_date": "05/02/2013 16:37:44",
      "content": "<p>What is n_output, the number of classes? What is the error?</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23824,
      "author_name": "rkirana",
      "author_url": "",
      "post_date": "05/02/2013 16:39:36",
      "content": "<p>It shows the follwoing error when we make nhid to 1000 or any arbitrary value</p>\r\n<p>only value that works is the default nhid = n_output</p>\r\n<p>&nbsp;</p>\r\n<p>Traceback (most recent call last):<br>\r\n&nbsp; File &quot;/home/kirana/pylearn2/pylearn2/scripts/tutorials/deep_trainer/run_deep_trainer.py&quot;, line 282, in &lt;module&gt;<br>\r\n&nbsp;&nbsp;&nbsp; main()<br>\r\n&nbsp; File &quot;/home/kirana/pylearn2/pylearn2/scripts/tutorials/deep_trainer/run_deep_trainer.py&quot;, line 268, in main<br>\r\n&nbsp;&nbsp;&nbsp; layer_trainer.main_loop()<br>\r\n&nbsp; File &quot;/usr/local/lib/python2.7/dist-packages/pylearn2-0.1dev-py2.7.egg/pylearn2/train.py&quot;, line 116, in main_loop<br>\r\n&nbsp;&nbsp;&nbsp; self.run_callbacks_and_monitoring()<br>\r\n&nbsp; File &quot;/usr/local/lib/python2.7/dist-packages/pylearn2-0.1dev-py2.7.egg/pylearn2/train.py&quot;, line 137, in run_callbacks_and_monitoring<br>\r\n&nbsp;&nbsp;&nbsp; self.model.monitor()<br>\r\n&nbsp; File &quot;/usr/local/lib/python2.7/dist-packages/pylearn2-0.1dev-py2.7.egg/pylearn2/monitor.py&quot;, line 195, in __call__<br>\r\n&nbsp;&nbsp;&nbsp; a(X)<br>\r\n&nbsp; File &quot;/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py&quot;, line 586, in __call__<br>\r\n&nbsp;&nbsp;&nbsp; gof.vm.raise_with_op(self.fn.nodes[self.fn.position_of_error])<br>\r\n&nbsp; File &quot;/usr/local/lib/python2.7/dist-packages/theano/compile/function_module.py&quot;, line 580, in __call__<br>\r\n&nbsp;&nbsp;&nbsp; outputs = self.fn()<br>\r\nValueError: Shape mismatch: x has 1000 cols (and 10 rows) but y has 10 rows (and 1000 cols)<br>\r\n<br>\r\n<br>\r\n</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23825,
      "author_name": "iangoodfellow",
      "author_url": "",
      "post_date": "05/02/2013 16:41:22",
      "content": "<p>I've asked the author of the tutorial to look into it.</p>",
      "votes": null,
      "replies": []
    },
    {
      "id": 23828,
      "author_name": "macmadman",
      "author_url": "",
      "post_date": "05/02/2013 17:52:19",
      "content": "<p>When trying to stack models, you need to make sure the shape of inputs and outputs from subsequent layers are consistent. That means, the outputs from layer i should have the same shape of inputs for layer i&#43;1. It looks like you have a problem over there.</p>",
      "votes": null,
      "replies": []
    }
  ],
  "raw_markdown_by_id": {
    "23766": "",
    "23767": "",
    "23768": "",
    "23769": "",
    "23770": "",
    "23771": "",
    "23772": "",
    "23776": "",
    "23813": "",
    "23817": "",
    "23822": "",
    "23823": "",
    "23824": "",
    "23825": "",
    "23828": ""
  },
  "source": "meta"
}