def test_1_in_1_out(self): state = State(42) state.set_biases([1]) state.set_weights([[2]]) self.assertListEqual(state.activate([5]), [11])
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])
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])
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])
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])
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])
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])
def test_not_without_weights(self): state = State(42) state.set_biases([2, 3]) self.assertRaises(AssertionError, state.activate, [5, 10])