Пример #1
0
    def test_reg_cost_func_data4_3(self, data4):
        y = data4[:, -1:]
        X = 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)
Пример #2
0
 def J(theta):
     return reg_cost_func(X, y, theta, _lambda)