Ejemplo n.º 1
0
 def testLogisticSigmoid(self):
     sigmoid = LogisticActivationFunction()
     output = sigmoid.activate(np.matrix([-1, -.5, 0, .5, 1]))
     self.assertAlmostEqual(output[0,0], .268941, places=5)
     self.assertAlmostEqual(output[0,1], .377540, places=5)
     self.assertAlmostEqual(output[0,2], .500000, places=5)
     self.assertAlmostEqual(output[0,3], .622459, places=5)
     self.assertAlmostEqual(output[0,4], .731058, places=5)
Ejemplo n.º 2
0
 def testLogisticSigmoidDerivative(self):
     sigmoid = LogisticActivationFunction()
     output = sigmoid.derivative(np.matrix([.25, .5, .75]))
     self.assertAlmostEqual(output[0,0], .1875, places=4)
     self.assertAlmostEqual(output[0,1], .2500, places=4)
     self.assertAlmostEqual(output[0,2], .1875, places=4)