| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# import all the conx API
from pyrobot.brain.conx import *
# create the network
n = Network()
# add layers in the order they will be connected
n.addLayer('input',2) # The input layer has two nodes
n.addLayer('output',1) # The output layer has one node
n.connect('input','output') # The input layer is connected to the output layer
# provide training patterns (inputs and outputs)
n.setInputs([[0.0,0.0],[0.0,1.0],[1.0,0.0],[1.0,1.0]])
n.setOutputs([[0.0],[0.0],[0.0],[1.0]])
# set learning parameters
n.setEpsilon(0.5)
n.setTolerance(0.2)
n.setReportRate(1)
# learn
n.train() |