Example #1
0
    def test_RidgeLinearRegression_cost_data2_1(self, data2):
        y = data2[:, -1:]
        X = data2[:, :-1]
        _, n = X.shape
        theta = ones((n + 1, 1), dtype=float64)
        lr = RidgeLinearRegression(theta, _lambda=0)

        assert_allclose([[64828197300.798]], lr.cost(X, y), rtol=0, atol=0.001)
Example #2
0
    def test_RidgeLinearRegression_cost_data1_2(self, data1):

        y = data1[:, -1:]
        X = data1[:, :-1]
        _, n = X.shape
        theta = ones((n + 1, 1), dtype=float64)
        lr = RidgeLinearRegression(theta, _lambda=100)

        assert_allclose([[10.781984]], lr.cost(X, y), rtol=0, atol=0.001)