Skip to content

Overflow Runtime Warning for Numpy Logistic Function in CalibratedClassifierCV with SVM #12896

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ZaydH opened this issue Dec 31, 2018 · 2 comments · Fixed by #12909
Closed

Comments

@ZaydH
Copy link
Contributor

ZaydH commented Dec 31, 2018

Description

Overflow Runtime Warning for Numpy Logistic Function in CalibratedClassifierCV with SVM

Steps/Code to Reproduce

Training a soft-margin SVM inside a CalibrationClassifierCV using sigmoid (Platt) scaling. Below is the definition of the classifier:

g_svm = svm.SVC(gamma='auto') g = CalibratedClassifierCV(g_svm, method='sigmoid', cv=10)

I am not able to share the dataset publicly. I could try to create a synthetic one if it is useful/needed. The warning is intermittent.

Expected Results

No runtime warning is reported.

Actual Results

/sklearn/calibration.py:520: RuntimeWarning: overflow encountered in exp
return 1. / (1. + np.exp(self.a_ * T + self.b_))

Versions

System:
python: 3.7.1 (default, Dec 12 2018, 01:02:44) [Clang 10.0.0 (clang-1000.11.45.5)]
executable:
machine: Darwin-18.2.0-x86_64-i386-64bit

BLAS:
macros: NO_ATLAS_INFO=3, HAVE_CBLAS=None
lib_dirs:
cblas_libs: cblas

Python deps:
pip: 18.1
setuptools: 39.0.1
sklearn: 0.20.1
numpy: 1.15.4
scipy: 1.1.0
Cython: None
pandas: 0.23.4

@ZaydH
Copy link
Contributor Author

ZaydH commented Dec 31, 2018

Changing the function to use expit worked on my personal test case. If you would like a pull-request raised, I can do so.

@jnothman
Copy link
Member

jnothman commented Jan 2, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants