summaryrefslogtreecommitdiff
path: root/pybrain_experiments/test.py
diff options
context:
space:
mode:
authorpepperpepperpepper <pepper@scannerjammer.com>2015-10-17 18:37:04 -0700
committerpepperpepperpepper <pepper@scannerjammer.com>2015-10-17 18:37:04 -0700
commit10a619b2c7227b2ad214fbb985141b884fbe87fb (patch)
treec70b711213f88de613b18791c6c123a6ad73a3ae /pybrain_experiments/test.py
parentb10e46d0efca25234b18c28a47393cbf365b3c0d (diff)
ok pybrain time
Diffstat (limited to 'pybrain_experiments/test.py')
-rw-r--r--pybrain_experiments/test.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/pybrain_experiments/test.py b/pybrain_experiments/test.py
new file mode 100644
index 0000000..f7b0a01
--- /dev/null
+++ b/pybrain_experiments/test.py
@@ -0,0 +1,35 @@
+from pybrain.structure import FeedForwardNetwork
+from pybrain.structure import LinearLayer, SigmoidLayer
+from pybrain.structure import FullConnection
+n = FeedForwardNetwork()
+
+inLayer = LinearLayer(2)
+hiddenLayer = SigmoidLayer(3)
+outLayer = LinearLayer(1)
+
+n.addInputModule(inLayer)
+n.addModule(hiddenLayer)
+n.addOutputModule(outLayer)
+
+in_to_hidden = FullConnection(inLayer, hiddenLayer)
+hidden_to_out = FullConnection(hiddenLayer, outLayer)
+
+
+n.addConnection(in_to_hidden)
+n.addConnection(hidden_to_out)
+
+
+# everything is wired together now
+# this makes it usable
+
+n.sortModules()
+
+
+if __name__ == "__main__":
+ #Again, this might look different on your machine -
+ #the weights of the connections have already been initialized randomly.
+ print n.activate([1, 2])
+ #look at the hidden weights
+ print in_to_hidden.params
+ print hidden_to_out.params
+ print n.params #weights here too