def test_actvByAllInput(self): inputArr2D = array(((0.41, 0.51, 0.61), (0.73, 0.63, 0.53))) result = asarray(self.hiddenL.actvByAllInput(inputArr2D)) assert_array_almost_equal(result[0], ravel(sigmoid(array((0.41, 0.51, 0.61, 1)) * matrix(((0.4, 0.5, 0.6, 0.7), (0.8, 0.9, 1, 1.1), (1.2, 1.3, 1.4, 1.5))).T))) assert_array_almost_equal(result[1], ravel(sigmoid(array((0.73, 0.63, 0.53, 1)) * matrix(((0.4, 0.5, 0.6, 0.7), (0.8, 0.9, 1, 1.1), (1.2, 1.3, 1.4, 1.5))).T)))
def test_sigmoid(self): result = sigmoid(self.theta * self.x) self.assertAlmostEqual(result[0], 1.0 / (1 + npe ** (-4))) self.assertAlmostEqual(result[1], 1.0 / (1 + npe ** (-10))) self.assertAlmostEqual(result[2], 1.0 / (1 + npe ** (-18)))