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
def forward_pass(self, theta, X): return FullConnection.forward_pass(self, theta, add_bias(X))
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
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]])
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)