示例#1
0
 def test_prop_up(self):
     res = self.rbm.prop_up(self.visible_layer)
     expected = neur.sigmoid(np.array([[ 1.260987,  2.484167],
                                       [ 1.142713,  1.844246],
                                       [ 0.878157,  1.070012],
                                       [ 0.364556,  0.974234]]))
     self.assertTrue(self.all_equalish(res, expected))
示例#2
0
 def encode(self, x):
     # add ones
     m = len(x)
     x = np.hstack([np.ones((m,1)), x])
     return neur.sigmoid(np.dot(x, self.encode_weights.transpose()))
示例#3
0
 def test_prop_up(self):
     res = self.rbm.prop_up(self.visible_layer)
     expected = neur.sigmoid(
         np.array([[1.260987, 2.484167], [1.142713, 1.844246],
                   [0.878157, 1.070012], [0.364556, 0.974234]]))
     self.assertTrue(self.all_equalish(res, expected))
示例#4
0
文件: rbm.py 项目: bhauman/neurpy
 def prop_up(self, vis_layer):
     return neur.sigmoid(np.dot(vis_layer, self.weights.transpose()))
示例#5
0
文件: rbm.py 项目: bhauman/neurpy
 def prop_down(self, hid_layer):
     return neur.sigmoid(np.dot(hid_layer, self.weights))
示例#6
0
 def test_sigmoid(self):
     res = neur.sigmoid(np.array(([1, 2], [3, 4])))
     target = np.array([[0.7310585, 0.88079708], [0.95257413, 0.98201379]])
     self.equalish(res, target)
示例#7
0
 def prop_down(self, hid_layer):
     vis_bias = self.expand_visible_bias(hid_layer.shape[0])
     return neur.sigmoid(np.dot(hid_layer, self.weights) + vis_bias)
示例#8
0
 def prop_up(self, vis_layer):
     hid_bias = self.expand_hidden_bias(vis_layer.shape[0])
     res = np.dot(vis_layer, self.weights.transpose()) + hid_bias
     return neur.sigmoid(res)
示例#9
0
 def test_sigmoid(self):
     res = neur.sigmoid(np.array(([1, 2], [3, 4])))
     target = np.array([[0.7310585, 0.88079708], [0.95257413, 0.98201379]])
     self.equalish(res, target)
示例#10
0
 def prop_down(self, hid_layer):
     vis_bias = self.expand_visible_bias(hid_layer.shape[0])
     return neur.sigmoid(np.dot(hid_layer, self.weights) + vis_bias)
示例#11
0
 def prop_up(self, vis_layer):
     hid_bias = self.expand_hidden_bias(vis_layer.shape[0])
     res = np.dot(vis_layer, self.weights.transpose()) + hid_bias
     return neur.sigmoid(res)