Example #1
0
    def test_expose_not_training(self):
        n = Neuron(S0 = 16, H = 4.0, G = 2.0)

        w1 = Word([1,6,9])
        assert_false(n.expose(w1))

        w2 = Word([1,3,4,5,6,8,9,14])
        assert_true(n.expose(w2))
Example #2
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))
Example #3
0
 def test_train_not_training(self):
     n = Neuron()
     w = Word()
     assert_false(n.train(w))
Example #4
0
 def test_expose_index_error(self):
     n = Neuron(S0 = 16)
     w = Word([16])
     n.expose(w)