def test_supervisedpcaRegressor_predict():
    diabetes=datasets.load_diabetes()
    X = diabetes.data
    Y = diabetes.target

    spca = SupervisedPCARegressor()
    spca.fit(X, Y)
    
    predictions = spca.predict(X)
    mae=np.mean(abs(predictions-Y))
    assert_almost_equal(mae,51.570682097)
Exemple #2
0
def test_supervisedpcaRegressor_predict():
    diabetes = datasets.load_diabetes()
    X = diabetes.data
    Y = diabetes.target

    spca = SupervisedPCARegressor()
    spca.fit(X, Y)

    predictions = spca.predict(X)
    mae = np.mean(abs(predictions - Y))
    assert_almost_equal(mae, 51.570682097)
def test_supervisedpcaRegressor_fit():
    # Test LinearRegression on a simple dataset.
    # a simple dataset
    diabetes=datasets.load_diabetes()
    X = diabetes.data
    Y = diabetes.target

    spca = SupervisedPCARegressor()
    spca.fit(X, Y,threshold=300,n_components=2)

    assert_array_equal(spca._leavouts,[1,5])
    assert_almost_equal(spca._model.coef_[0], [-537.7584256])
Exemple #4
0
def test_supervisedpcaRegressor_fit():
    # Test LinearRegression on a simple dataset.
    # a simple dataset
    diabetes = datasets.load_diabetes()
    X = diabetes.data
    Y = diabetes.target

    spca = SupervisedPCARegressor()
    spca.fit(X, Y, threshold=300, n_components=2)

    assert_array_equal(spca._leavouts, [1, 5])
    assert_almost_equal(spca._model.coef_[0], [-537.7584256])