コード例 #1
0
from Net import Net
#timeVideo="4"
timeVideo = "4.554"
a = 10
if __name__ == '__main__':
    topology = []
    topology.append(3)
    topology.append(2)
    topology.append(1)
    #print(topology)
    myNet = Net(topology)
    inputVals = [1, 2, 3, 4]
    myNet.feedForward(inputVals)

    result = myNet.getReseults()
    print(result)
コード例 #2
0
ファイル: xor-test.py プロジェクト: gmpetrov/nn-py
    # Conf of the net
    config = [2, 3, 3, 1]

    nn = Net(config)

    for i in range(0, 2000):
        # Generate dataset
        a = 0.0 if random.uniform(0.0, 1.0) <= 0.5 else 1.0
        b = 0.0 if random.uniform(0.0, 1.0) > 0.5 else 1.0

        # Target value
        res = int(a) ^ int(b)

        inputVals = []
        inputVals.append(a)
        inputVals.append(b)

        targetVals = []
        targetVals.append(res)

        nn.feedForward(inputVals)
        print "Inputs : " + str(inputVals)

        nn.backPropagation(targetVals)
        print "Target : " + str(targetVals[0])

        resultVals = []
        resultVals = nn.getResults()
        print resultVals
        print "========="