Beispiel #1
0
    def test_reg_cost_func_data4_3(self):
        y = self.data4[:, -1:]
        X = self.data4[:, :-1]
        m, n = X.shape
        intercept = ones((m, 1), dtype=float64)
        X = append(intercept, X, axis=1)
        theta = -0.1 * ones((n + 1, 1), dtype=float64)
        _lambda = 1000000

        assert_allclose(66.502,
                        reg_cost_func(X, y, theta, _lambda),
                        rtol=0,
                        atol=0.001,
                        equal_nan=False)
Beispiel #2
0
 def J(theta):
     return reg_cost_func(X, y, theta, _lambda)