Closed
Description
https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=101693
____________________ test_sag_regressor_computed_correctly _____________________
[gw1] linux -- Python 3.7.3 $PREFIX/bin/python
@pytest.mark.filterwarnings('ignore:The max_iter was reached')
def test_sag_regressor_computed_correctly():
"""tests if the sag regressor is computed correctly"""
alpha = .1
n_features = 10
n_samples = 40
max_iter = 50
tol = .000001
fit_intercept = True
rng = np.random.RandomState(0)
X = rng.normal(size=(n_samples, n_features))
w = rng.normal(size=n_features)
y = np.dot(X, w) + 2.
step_size = get_step_size(X, alpha, fit_intercept, classification=False)
clf1 = Ridge(fit_intercept=fit_intercept, tol=tol, solver='sag',
alpha=alpha * n_samples, max_iter=max_iter)
clf2 = clone(clf1)
clf1.fit(X, y)
clf2.fit(sp.csr_matrix(X), y)
spweights1, spintercept1 = sag_sparse(X, y, step_size, alpha,
n_iter=max_iter,
dloss=squared_dloss,
fit_intercept=fit_intercept)
spweights2, spintercept2 = sag_sparse(X, y, step_size, alpha,
n_iter=max_iter,
dloss=squared_dloss, sparse=True,
fit_intercept=fit_intercept)
assert_array_almost_equal(clf1.coef_.ravel(),
spweights1.ravel(),
> decimal=3)
E AssertionError:
E Arrays are not almost equal to 3 decimals
E
E Mismatch: 10%
E Max absolute difference: 0.00238873
E Max relative difference: 0.00495185
E x: array([-0.467, -0.967, 0.652, 0.318, -1.616, 0.306, 0.711, 0.068,
E -0.238, -0.634])
E y: array([-0.468, -0.969, 0.653, 0.319, -1.616, 0.305, 0.711, 0.068,
E -0.239, -0.633])
Building scikit-learn 0.22 on conda-forge conda-forge/scikit-learn-feedstock#113
Metadata
Metadata
Assignees
Labels
No labels