Esempio n. 1
0
    def test_train(self):
        n = Neuron(16, 4.0, 2.0)
        wA = Word([1,6,9,14])
        wB = Word([3,4,9,13])

        n.start_training()
        assert_true(n.train(wA))
        assert_true(n.train(wB))
        n.end_training()

        wD = Word([2,6,12,14])
        wE = Word([3,7,9,13])
        assert_false(n.expose(wD))
        assert_false(n.expose(wE))

        wF = Word([1,4,9,14])
        assert_true(n.expose(wF))
Esempio n. 2
0
 def test_train_not_training(self):
     n = Neuron()
     w = Word()
     assert_false(n.train(w))