예제 #1
0
def test_linear_regressor_score_not_fitted():
    """Test of `LinearRegressor` class with score calculation without fit."""
    lr = LinearRegressor(learning_rate=0.1, iterations=1, standardize=False)

    X = np.array([1])
    y = np.array([1])

    with pytest.raises(NotFitted):
        lr.score(X, y)
예제 #2
0
def test_linear_regressor_normal():
    """Test of `normal` method of `LinearRegressor` class."""
    lr = LinearRegressor(learning_rate=0.1, iterations=1, standardize=False)

    X = np.array([1])
    y = np.array([1])

    lr.normal(X, y)

    assert lr.score(X, y) == 1
예제 #3
0
def test_linear_regressor_standardized():
    """Test of `LinearRegressor` class with standardization."""
    lr = LinearRegressor(learning_rate=0.1, iterations=1, standardize=True)

    X = np.array([1])
    y = np.array([1])

    lr.fit(X, y)

    assert lr.score(X, y) == 1