Пример #1
0
 def test_1_in_1_out(self):
     state = State(42)
     state.set_biases([1])
     state.set_weights([[2]])
     self.assertListEqual(state.activate([5]), [11])
Пример #2
0
 def test_2_in_3_out(self):
     state = State(42)
     state.set_biases([0, 1, 2])
     state.set_weights([[2, 3], [4, 5], [1, 2]])
     self.assertListEqual(state.activate([5, 10]), [40, 71, 27])
Пример #3
0
 def test_3_in_2_out(self):
     state = State(42)
     state.set_biases([0, 1])
     state.set_weights([[2, 3, 1], [4, 5, 1]])
     self.assertListEqual(state.activate([5, 10, 20]), [60, 91])
Пример #4
0
 def test_2_in_1_out(self):
     state = State(42)
     state.set_biases([0])
     state.set_weights([[2, 3]])
     self.assertListEqual(state.activate([5, 10]), [40])
Пример #5
0
 def test_to_little_weight_length(self):
     state = State(42)
     state.set_biases([2, 3])
     state.set_weights([[2], [2]])
     self.assertRaises(AssertionError, state.activate, [5, 2])
Пример #6
0
 def test_to_many_weight_length(self):
     state = State(42)
     state.set_biases([2, 2])
     state.set_weights([[2, 3, 3], [3, 4, 5]])
     self.assertRaises(AssertionError, state.activate, [5, 10])
Пример #7
0
 def test_too_short_bias_length(self):
     state = State(42)
     state.set_biases([2])
     state.set_weights([[2, 3], [4, 5]])
     self.assertRaises(AssertionError, state.activate, [5, 10])
Пример #8
0
 def test_not_without_weights(self):
     state = State(42)
     state.set_biases([2, 3])
     self.assertRaises(AssertionError, state.activate, [5, 10])