Пример #1
0
 def testSigmoid(self):
     self.assertEqual(ctrnn.sigmoid(1000), 1.0)
     self.assertEqual(ctrnn.sigmoid(-1000), 0.0) # Not OverflowError
     self.assertEqual(ctrnn.sigmoid(0), 0.5)
     self.assertEqual(ctrnn.sigmoid(0, gain=4), 0.5)
     # 0.401312339887548
     assert 0.401 < ctrnn.sigmoid(0, gain=4, bias=0.1) < 0.402 
     # 2.6503965530043108e-261
     assert 0.0 < ctrnn.sigmoid(-600) < 2.66e-261 
Пример #2
0
def sigmoid_bias(x):
    """Sigmoid with gain and bias set according to Soiland."""
    return ctrnn.sigmoid(x, gain=1, bias=-0.1)
Пример #3
0
def sigmoid_bias(x):
    """Sigmoid with gain and bias set according to Berns1998."""
    return ctrnn.sigmoid(x, gain=4, bias=0.0)