Ejemplo n.º 1
0
    def test_predict_2(self):
        X = array([[3.5]])
        m, n = X.shape
        intercept = ones((m, 1), dtype=float64)
        X = append(intercept, X, axis=1)
        theta = zeros((n + 1, 1), dtype=float64)

        assert_allclose([[0]], predict(X, theta), rtol=0, atol=0.001)
Ejemplo n.º 2
0
    def test_predict_4(self):
        X = array([[-3.5, 2.7]])
        m, n = X.shape
        intercept = ones((m, 1), dtype=float64)
        X = append(intercept, X, axis=1)
        theta = -1 * ones((n + 1, 1), dtype=float64)

        assert_allclose([[-0.2]], predict(X, theta), rtol=0, atol=0.001)
Ejemplo n.º 3
0
    def test_predict_1(self):
        X = array([[3.5]])
        m, n = X.shape
        intercept = ones((m, 1), dtype=float64)
        X = append(intercept, X, axis=1)
        theta = array([[-3.6303], [1.1664]])

        assert_allclose([[0.4521]], predict(X, theta), rtol=0, atol=0.001)