Mercurial > pylearn
comparison test_mlp.py @ 187:ebbb0e749565
added mlp_factory_approach
author | James Bergstra <bergstrj@iro.umontreal.ca> |
---|---|
date | Wed, 14 May 2008 11:51:08 -0400 |
parents | 562f308873f0 |
children |
comparison
equal
deleted
inserted
replaced
186:562f308873f0 | 187:ebbb0e749565 |
---|---|
97 | 97 |
98 output_ds = fprop(training_set) | 98 output_ds = fprop(training_set) |
99 | 99 |
100 for fieldname in output_ds.fieldNames(): | 100 for fieldname in output_ds.fieldNames(): |
101 print fieldname+"=",output_ds[fieldname] | 101 print fieldname+"=",output_ds[fieldname] |
102 | |
103 def test_interface_0(): | |
104 learner = ManualNNet(2, 10, 3, .1, 1000) | |
105 | |
106 model = learner(training_set) | |
107 | |
108 model2 = learner(training_set) # trains model a second time | |
109 | |
110 learner.update(additional_data) # modifies nnet and model by side-effect | |
111 | |
112 | |
113 def test_interface2_1(): | |
114 learn_algo = ManualNNet(2, 10, 3, .1, 1000) | |
115 | |
116 prior = learn_algo() | |
117 | |
118 model1 = learn_algo(training_set1) | |
119 | |
120 model2 = learn_algo(training_set2) | |
121 | |
122 model2.update(additional_data) | |
123 | |
124 n_match = 0 | |
125 for o1, o2 in zip(model1.use(test_data), model2.use(test_data)): | |
126 n_match += (o1 == o2) | |
127 | |
128 print n_match | |
129 | |
102 test1() | 130 test1() |
103 test2() | 131 test2() |
104 | 132 |