comparison sandbox/rbm/main.py @ 400:269d5c5a4209

Cleaned up, added sparse_instance
author Joseph Turian <turian@gmail.com>
date Tue, 08 Jul 2008 23:59:57 -0400
parents 8796b91a9f09
children ffdd2c199f2a
comparison
equal deleted inserted replaced
399:8796b91a9f09 400:269d5c5a4209
1 #!/usr/bin/python 1 #!/usr/bin/python
2 """ 2 """
3 An RBM with binomial units trained with CD-1. 3 Simple SGD RBM training.
4 (An example of how to use the model.)
4 """ 5 """
5 6
6 7
7 import numpy 8 import numpy
8 9
20 for i in xrange(100000): 21 for i in xrange(100000):
21 # Select an instance 22 # Select an instance
22 instance = nonzero_instances[i % len(nonzero_instances)] 23 instance = nonzero_instances[i % len(nonzero_instances)]
23 24
24 # SGD update over instance 25 # SGD update over instance
25 model.update(instance) 26 model.update([instance])