Skip to content

Commit

Permalink
Compatibility for old scipy
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabian Pedregosa authored and MechCoder committed Jul 22, 2014
1 parent 228f5b0 commit 174205e
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions sklearn/linear_model/logistic.py
Expand Up @@ -267,10 +267,17 @@ def logistic_regression_path(X, y, Cs=10, fit_intercept=True,
if callback is not None:
callback(w0, X, y, 1. / C)
if solver == 'lbfgs':
out = optimize.fmin_l_bfgs_b(
func, w0, fprime=None,
args=(X, y, 1. / C),
iprint=verbose > 0, pgtol=gtol, maxiter=max_iter)
try:
out = optimize.fmin_l_bfgs_b(
func, w0, fprime=None,
args=(X, y, 1. / C),
iprint=verbose > 0, pgtol=gtol, maxiter=max_iter)
except TypeError:
# old scipy doesn't have maxiter
out = optimize.fmin_l_bfgs_b(
func, w0, fprime=None,
args=(X, y, 1. / C),
iprint=verbose > 0, pgtol=gtol)
w0 = out[0]
elif solver == 'newton-cg':
if fit_intercept:
Expand Down

0 comments on commit 174205e

Please sign in to comment.