Example #1
0
 def backprop(self, theta, X, Y, out_error):
     in_error, grad = FullConnection.backprop(self, theta, add_bias(X), Y, out_error)
     return in_error[:,:-1], grad
Example #2
0
 def forward_pass(self, theta, X):
     return FullConnection.forward_pass(self, theta, add_bias(X))
Example #3
0
 def backprop(self, theta, X, Y, out_error):
     in_error, grad = FullConnection.backprop(self, theta, add_bias(X), Y,
                                              out_error)
     return in_error[:, :-1], grad
Example #4
0
 def forward_pass(self, theta, X):
     return FullConnection.forward_pass(self, theta, add_bias(X))
Example #5
0
def test_add_bias_single_sample():
    x = np.array([2, 3, 4])
    x_wb = add_bias(x)
    assert_equal(x_wb.shape, (1, 4))
    assert_equal(x_wb, [[2, 3, 4, 1]])
Example #6
0
def test_add_bias_many_samples():
    x = np.array([[2, 3, 4]]*5)
    x_wb = add_bias(x)
    assert_equal(x_wb.shape, (5, 4))
    assert_equal(x_wb, [[2, 3, 4, 1]]*5)