annotate test_mlp.py @ 180:2698c0feeb54

mlp seems to work!
author Yoshua Bengio <bengioy@iro.umontreal.ca>
date Tue, 13 May 2008 15:35:43 -0400
parents 0d8e721cc63c
children 25d0a0c713da
rev   line source
121
2ca8dccba270 debugging mlp.py
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
diff changeset
1
2ca8dccba270 debugging mlp.py
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
diff changeset
2 from mlp import *
133
b4657441dd65 Corrected typos
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents: 121
diff changeset
3 import dataset
121
2ca8dccba270 debugging mlp.py
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
diff changeset
4
2ca8dccba270 debugging mlp.py
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
diff changeset
5 def test0():
180
2698c0feeb54 mlp seems to work!
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents: 135
diff changeset
6 nnet = OneHiddenLayerNNetClassifier(10,2,.001,1000)
133
b4657441dd65 Corrected typos
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents: 121
diff changeset
7 training_set = dataset.ArrayDataSet(numpy.array([[0, 0, 0],
b4657441dd65 Corrected typos
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents: 121
diff changeset
8 [0, 1, 1],
b4657441dd65 Corrected typos
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents: 121
diff changeset
9 [1, 0, 1],
b4657441dd65 Corrected typos
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents: 121
diff changeset
10 [1, 1, 1]]),
b4657441dd65 Corrected typos
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents: 121
diff changeset
11 {'input':slice(2),'target':2})
b4657441dd65 Corrected typos
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents: 121
diff changeset
12 fprop=nnet(training_set)
121
2ca8dccba270 debugging mlp.py
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
diff changeset
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
2ca8dccba270 debugging mlp.py
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
diff changeset
18
2ca8dccba270 debugging mlp.py
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
diff changeset
19 test0()
2ca8dccba270 debugging mlp.py
Yoshua Bengio <bengioy@iro.umontreal.ca>
parents:
diff changeset
20