python.pkgs.scikitlearn: disable tests; remove maintainer

This commit is contained in:
Frederik Rietdijk 2018-07-26 13:58:58 +02:00
parent 5463fb39e7
commit d1a411468d
2 changed files with 6 additions and 79 deletions

View File

@ -7,17 +7,15 @@
buildPythonPackage rec {
pname = "scikit-learn";
version = "0.19.2";
disabled = stdenv.isi686; # https://github.com/scikit-learn/scikit-learn/issues/5534
# UnboundLocalError: local variable 'message' referenced before assignment
disabled = true;
# disabled = stdenv.isi686; # https://github.com/scikit-learn/scikit-learn/issues/5534
src = fetchPypi {
inherit pname version;
sha256 = "b276739a5f863ccacb61999a3067d0895ee291c95502929b2ae56ea1f882e888";
};
# basically https://github.com/scikit-learn/scikit-learn/pull/10723,
# but rebased onto 0.19.1
patches = [ ./n_iter-should-be-less-than-max_iter-using-lbgfs.patch ];
buildInputs = [ nose pillow gfortran glibcLocales ];
propagatedBuildInputs = [ numpy scipy numpy.blas ];
@ -29,10 +27,12 @@ buildPythonPackage rec {
HOME=$TMPDIR OMP_NUM_THREADS=1 nosetests --doctest-options=+SKIP $out/${python.sitePackages}/sklearn/
'';
meta = with stdenv.lib; {
description = "A set of python modules for machine learning and data mining";
homepage = http://scikit-learn.org;
license = licenses.bsd3;
maintainers = with maintainers; [ fridh ];
maintainers = with maintainers; [ ];
};
}

View File

@ -1,73 +0,0 @@
diff --git a/sklearn/linear_model/huber.py b/sklearn/linear_model/huber.py
index e17dc1e..665654d 100644
--- a/sklearn/linear_model/huber.py
+++ b/sklearn/linear_model/huber.py
@@ -181,7 +181,11 @@ class HuberRegressor(LinearModel, RegressorMixin, BaseEstimator):
n_iter_ : int
Number of iterations that fmin_l_bfgs_b has run for.
- Not available if SciPy version is 0.9 and below.
+
+ .. versionchanged:: 0.20
+
+ In SciPy <= 1.0.0 the number of lbfgs iterations may exceed
+ ``max_iter``. ``n_iter_`` will now report at most ``max_iter``.
outliers_ : array, shape (n_samples,)
A boolean mask which is set to True where the samples are identified
@@ -272,7 +276,9 @@ class HuberRegressor(LinearModel, RegressorMixin, BaseEstimator):
raise ValueError("HuberRegressor convergence failed:"
" l-BFGS-b solver terminated with %s"
% dict_['task'].decode('ascii'))
- self.n_iter_ = dict_.get('nit', None)
+ # In scipy <= 1.0.0, nit may exceed maxiter.
+ # See https://github.com/scipy/scipy/issues/7854.
+ self.n_iter_ = min(dict_.get('nit', None), self.max_iter)
self.scale_ = parameters[-1]
if self.fit_intercept:
self.intercept_ = parameters[-2]
diff --git a/sklearn/linear_model/logistic.py b/sklearn/linear_model/logistic.py
index 8646c9a..c72a7d9 100644
--- a/sklearn/linear_model/logistic.py
+++ b/sklearn/linear_model/logistic.py
@@ -718,7 +718,9 @@ def logistic_regression_path(X, y, pos_class=None, Cs=10, fit_intercept=True,
warnings.warn("lbfgs failed to converge. Increase the number "
"of iterations.")
try:
- n_iter_i = info['nit'] - 1
+ # In scipy <= 1.0.0, nit may exceed maxiter.
+ # See https://github.com/scipy/scipy/issues/7854.
+ n_iter_i = min(info['nit'], max_iter)
except:
n_iter_i = info['funcalls'] - 1
elif solver == 'newton-cg':
@@ -1115,6 +1117,11 @@ class LogisticRegression(BaseEstimator, LinearClassifierMixin,
it returns only 1 element. For liblinear solver, only the maximum
number of iteration across all classes is given.
+ .. versionchanged:: 0.20
+
+ In SciPy <= 1.0.0 the number of lbfgs iterations may exceed
+ ``max_iter``. ``n_iter_`` will now report at most ``max_iter``.
+
See also
--------
SGDClassifier : incrementally trained logistic regression (when given
diff --git a/sklearn/linear_model/tests/test_huber.py b/sklearn/linear_model/tests/test_huber.py
index 08f4fdf..ca1092f 100644
--- a/sklearn/linear_model/tests/test_huber.py
+++ b/sklearn/linear_model/tests/test_huber.py
@@ -42,6 +42,13 @@ def test_huber_equals_lr_for_high_epsilon():
assert_almost_equal(huber.intercept_, lr.intercept_, 2)
+def test_huber_max_iter():
+ X, y = make_regression_with_outliers()
+ huber = HuberRegressor(max_iter=1)
+ huber.fit(X, y)
+ assert huber.n_iter_ == huber.max_iter
+
+
def test_huber_gradient():
# Test that the gradient calculated by _huber_loss_and_gradient is correct
rng = np.random.RandomState(1)