comparison algorithms/daa.py @ 515:dc2d93590da0

Small bugfix in hidden weight initialization.
author Joseph Turian <turian@iro.umontreal.ca>
date Fri, 31 Oct 2008 16:37:19 -0400
parents da916044454c
children
comparison
equal deleted inserted replaced
514:a4d34dad3083 515:dc2d93590da0
137 sz = (input_size, hidden_size) 137 sz = (input_size, hidden_size)
138 inf = 1/N.sqrt(input_size) 138 inf = 1/N.sqrt(input_size)
139 hif = 1/N.sqrt(hidden_size) 139 hif = 1/N.sqrt(hidden_size)
140 obj.w1 = R.uniform(size = sz, low = -inf, high = inf) 140 obj.w1 = R.uniform(size = sz, low = -inf, high = inf)
141 if not self.tie_weights: 141 if not self.tie_weights:
142 obj.w2 = R.uniform(size = list(reversed(sz)), low = -inf, high = inf) 142 obj.w2 = R.uniform(size = list(reversed(sz)), low = -hif, high = hif)
143 obj.b1 = N.zeros(hidden_size) 143 obj.b1 = N.zeros(hidden_size)
144 obj.b2 = N.zeros(input_size) 144 obj.b2 = N.zeros(input_size)
145 if seed is not None: 145 if seed is not None:
146 obj.seed(seed) 146 obj.seed(seed)
147 obj.__hide__ = ['params'] 147 obj.__hide__ = ['params']