Mercurial > pylearn
annotate test_mlp.py @ 164:3518710e16ec
don't assume we have an ArrayDataSet
author | Frederic Bastien <bastienf@iro.umontreal.ca> |
---|---|
date | Mon, 12 May 2008 17:43:53 -0400 |
parents | 0d8e721cc63c |
children | 2698c0feeb54 |
rev | line source |
---|---|
121 | 1 |
2 from mlp import * | |
133 | 3 import dataset |
121 | 4 |
5 def test0(): | |
133 | 6 nnet = OneHiddenLayerNNetClassifier(10,3,.1,1000) |
7 training_set = dataset.ArrayDataSet(numpy.array([[0, 0, 0], | |
8 [0, 1, 1], | |
9 [1, 0, 1], | |
10 [1, 1, 1]]), | |
11 {'input':slice(2),'target':2}) | |
12 fprop=nnet(training_set) | |
121 | 13 |
135
0d8e721cc63c
Fixed bugs in dataset to make test_mlp.py work
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
133
diff
changeset
|
14 output_ds = fprop(training_set) |
0d8e721cc63c
Fixed bugs in dataset to make test_mlp.py work
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
133
diff
changeset
|
15 |
0d8e721cc63c
Fixed bugs in dataset to make test_mlp.py work
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
133
diff
changeset
|
16 for fieldname in output_ds.fieldNames(): |
0d8e721cc63c
Fixed bugs in dataset to make test_mlp.py work
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
133
diff
changeset
|
17 print fieldname+"=",output_ds[fieldname] |
121 | 18 |
19 test0() | |
20 |