Beispiel #1
0
 def test(self):
     layer = Layer(size=1,
                   prev_size=3,
                   activation=activation_functions.Sigmoid)
     layer.randomize()
     x = np.array([1, 9, -2], float)
     a, z = layer.feed(x)
     self.assertNotEqual(a[0], 0)
Beispiel #2
0
 def test_feed_with_sigmoid(self):
     layer = Layer(size=2,
                   prev_size=3,
                   activation=activation_functions.Sigmoid)
     x = np.array([1, 9, 323], float)
     a, z = layer.feed(x)
     self.assertEqual(z[0], 0)
     self.assertEqual(z[1], 0)
     self.assertEqual(a[0], 0.5)
     self.assertEqual(a[1], 0.5)
Beispiel #3
0
 def test_rectifier(self):
     layer = Layer(size=2,
                   prev_size=2,
                   activation=activation_functions.Sigmoid)
     layer.set_activation(activation_functions.Rectifier)
     self.assertEqual(layer.get_activation().__class__,
                      activation_functions.Rectifier.__class__)
     x = np.array([1, 9], float)
     a, z = layer.feed(x)
     self.assertEqual(a[0], 0)
     self.assertEqual(a[1], 0)