Mercurial > pylearn
comparison sandbox/simple_autoassociator/main.py @ 416:8849eba55520
Can now do minibatch update
author | Joseph Turian <turian@iro.umontreal.ca> |
---|---|
date | Fri, 11 Jul 2008 16:34:46 -0400 |
parents | 36baeb7125a4 |
children | 4f61201fa9a9 |
comparison
equal
deleted
inserted
replaced
415:319bf28c2dd5 | 416:8849eba55520 |
---|---|
5 The learned model is:: | 5 The learned model is:: |
6 h = sigmoid(dot(x, w1) + b1) | 6 h = sigmoid(dot(x, w1) + b1) |
7 y = sigmoid(dot(h, w2) + b2) | 7 y = sigmoid(dot(h, w2) + b2) |
8 | 8 |
9 Binary xent loss. | 9 Binary xent loss. |
10 | |
11 LIMITATIONS: | |
12 - Only does pure stochastic gradient (batchsize = 1). | |
13 """ | 10 """ |
14 | 11 |
15 | 12 |
16 import numpy | 13 import numpy |
17 | 14 |
25 | 22 |
26 import model | 23 import model |
27 model = model.Model() | 24 model = model.Model() |
28 | 25 |
29 for i in xrange(100000): | 26 for i in xrange(100000): |
30 # Select an instance | 27 # # Select an instance |
31 instance = nonzero_instances[i % len(nonzero_instances)] | 28 # instance = nonzero_instances[i % len(nonzero_instances)] |
32 | 29 |
33 # SGD update over instance | 30 # Update over instance |
34 model.update(instance) | 31 model.update(nonzero_instances) |