示例#1
0
    def test_simpleChain(self):
        inp = [[1]]
        out = [[0.412]]
        n = mlp(sizes=[1, 1, 1],
                weightGenerator=np.random.random,
                biasGenerator=np.random.random,
                activationFunction=LogSigmoid(1, -1))

        train(net=n, inputs=inp, outputs=out,
              numEpochs=200, learningRate=0.8)
        assert_allclose([n.forward(i) for i in inp], out, atol=0.1)
示例#2
0
    def test_simpleFork(self):
        inp = [[1]]
        out = [[0.44, 0.77, 0.33]]
        n = mlp(sizes=[len(inp[0]), len(out[0])],
                weightGenerator=np.random.random,
                biasGenerator=np.random.random,
                activationFunction=LogSigmoid(0, 1))

        train(net=n,
              inputs=inp,
              outputs=out,
              numEpochs=100,
              learningRate=0.7)

        assert_allclose([n.forward(i) for i in inp], out, atol=0.1)