comparison algorithms/stacker.py @ 503:c7ce66b4e8f4

Extensions to algorithms, and some cleanup (by defining linear_output result).
author Joseph Turian <turian@gmail.com>
date Wed, 29 Oct 2008 03:29:18 -0400
parents 2be795cc5c3a
children 2b0e10ac6929
comparison
equal deleted inserted replaced
502:17945defd813 503:c7ce66b4e8f4
70 R = N.random 70 R = N.random
71 for layer in obj.layers: 71 for layer in obj.layers:
72 if layer.lr is None: 72 if layer.lr is None:
73 layer.lr = lr 73 layer.lr = lr
74 if nunits: 74 if nunits:
75 obj.input_dimension = nunits[0]
76 obj.output_dimension = nunits[-1]
75 if len(nunits) != len(obj.layers) + 1: 77 if len(nunits) != len(obj.layers) + 1:
76 raise ValueError('You should give exactly one more unit numbers as there are layers.') 78 raise ValueError('You should give exactly one more unit numbers as there are layers.')
77 for ni, no, layer in zip(nunits[:-1], nunits[1:], obj.layers): 79 for ni, no, layer in zip(nunits[:-1], nunits[1:], obj.layers):
78 if seed is not None: 80 if seed is not None:
79 layer.initialize(ni, no, seed = R.random_integers(sys.maxint - 1)) 81 layer.initialize(ni, no, seed = R.random_integers(sys.maxint - 1))