Thanks to visit codestin.com
Credit goes to github.com

Skip to content

y_min y_max resolved #10981

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
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
15cb9d4
y_min y_max resolved
aishgrt1 Apr 15, 2018
ba0166b
test added for issue 10903
aishgrt1 Apr 15, 2018
08f4fbf
y_min y_max None condition changed
aishgrt1 Apr 15, 2018
a05d538
Update test_isotonic.py
aishgrt1 Apr 15, 2018
ae8a084
Update isotonic.py
aishgrt1 Apr 15, 2018
fe91f8c
Update calibration.py
aishgrt1 Apr 16, 2018
25ed665
Update isotonic.py
aishgrt1 Apr 16, 2018
8056cf5
Update calibration.py
aishgrt1 Apr 16, 2018
cda15d3
Update isotonic.py
aishgrt1 Apr 16, 2018
6573977
Update calibration.py
aishgrt1 Apr 16, 2018
feb68fc
Update test_isotonic.py
aishgrt1 Apr 16, 2018
9f68ce3
Update test_calibration.py
aishgrt1 Apr 16, 2018
987ef70
Update test_calibration.py
aishgrt1 Apr 16, 2018
4b93c33
Update test_calibration.py
aishgrt1 Apr 16, 2018
5c08dd9
np.clip used
aishgrt1 Apr 16, 2018
2d528e0
np.clip used
aishgrt1 Apr 16, 2018
9544f15
clipping proba value contribution added
aishgrt1 Apr 16, 2018
8ac986c
Update v0.20.rst
aishgrt1 Apr 16, 2018
987789f
Update calibration.py
aishgrt1 Apr 16, 2018
f96065f
Update calibration.py
aishgrt1 Apr 16, 2018
59d592b
Update calibration.py
aishgrt1 Apr 16, 2018
513a660
Update calibration.py
aishgrt1 Apr 16, 2018
73a3741
Update calibration.py
aishgrt1 Apr 16, 2018
3a36ed2
Update calibration.py
aishgrt1 Apr 16, 2018
5024bc6
data for test_calibration
aishgrt1 May 7, 2018
a1aab51
data for test_calibration
aishgrt1 May 7, 2018
be0f297
Update test_calibration.py
aishgrt1 May 7, 2018
ae66912
Update test_calibration.py
aishgrt1 May 7, 2018
50e68d3
Update test_calibration.py
aishgrt1 May 7, 2018
812ecd0
Update test_calibration.py
aishgrt1 May 7, 2018
2041182
Update test_calibration.py
aishgrt1 May 7, 2018
2eef8ea
Update calibration.rst
aishgrt1 May 7, 2018
3ddec45
Update calibration.rst
aishgrt1 May 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/modules/calibration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ redundant. The figure shows the estimated probabilities obtained with
logistic regression, a linear support-vector classifier (SVC), and linear SVC with
both isotonic calibration and sigmoid calibration. The calibration performance
is evaluated with Brier score :func:`brier_score_loss`, reported in the legend
(the smaller the better).
(the smaller the better). The Brier Score is composed of calibration loss and
refinment loss.

.. figure:: ../auto_examples/calibration/images/sphx_glr_plot_calibration_curve_002.png
:target: ../auto_examples/calibration/plot_calibration_curve.html
Expand Down
9 changes: 9 additions & 0 deletions doc/whats_new/v0.20.rst
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@ Classifiers and regressors
- :class:`dummy.DummyClassifier` and :class:`dummy.DummyRegresssor` now
only require X to be an object with finite length or shape.
:issue:`9832` by :user:`Vrishank Bhardwaj <vrishank97>`.

- :class:`neighbors.RadiusNeighborsRegressor` and
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The first seems like a rebase issue.

:class:`neighbors.RadiusNeighborsClassifier` are now
parallelized according to ``n_jobs`` regardless of ``algorithm``.
:issue:`8003` by :user:`Joël Billaud <recamshak>`.

- Clipped the values of proba between [0,1] in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The repetition of [0,1] is confusing

:class:`calibration` for probability values to lie between [0,1].
:issue: `10903` by :user:`Aishwarya Srinivasan <aishgrt1>`.

Cluster

Expand Down
4 changes: 2 additions & 2 deletions sklearn/calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ def predict_proba(self, X):
# XXX : for some reason all probas can be 0
proba[np.isnan(proba)] = 1. / n_classes

# Deal with cases where the predicted probability minimally exceeds 1.0
proba[(1.0 < proba) & (proba <= 1.0 + 1e-5)] = 1.0
proba[proba > 1.0] = 1.0
proba[proba < 0.0] = 0.0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why that line was checking for the eps here. Can you check who wrote that and ping them?


return proba

Expand Down
Binary file added sklearn/tests/data_X_test.pickle
Binary file not shown.
Binary file added sklearn/tests/data_X_train.pickle
Binary file not shown.
Binary file added sklearn/tests/data_y_train.pickle
Binary file not shown.
23 changes: 22 additions & 1 deletion sklearn/tests/test_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from __future__ import division
import numpy as np
from scipy import sparse
import pickle
from sklearn.model_selection import LeaveOneOut

from sklearn.utils.testing import (assert_array_almost_equal, assert_equal,
Expand All @@ -13,7 +14,7 @@
assert_raises,
ignore_warnings)
from sklearn.datasets import make_classification, make_blobs
from sklearn.naive_bayes import MultinomialNB
from sklearn.naive_bayes import MultinomialNB, GaussianNB
from sklearn.ensemble import RandomForestClassifier, RandomForestRegressor
from sklearn.svm import LinearSVC
from sklearn.pipeline import Pipeline
Expand Down Expand Up @@ -239,6 +240,26 @@ def test_sigmoid_calibration():
np.vstack((exF, exF)), exY)


def test_isotonic_calibration_prob_not_inf():
# Test from @LotusZephyr's issue:
# https://github.com/scikit-learn/scikit-learn/issues/10903
with open('data_X_train.pickle', 'rb') as f:
X_train = pickle.load(f)

with open('data_X_test.pickle', 'rb') as f:
X_test = pickle.load(f)

with open('data_y_train.pickle', 'rb') as f:
y_train = pickle.load(f)

clf = GaussianNB()
clf_c = CalibratedClassifierCV(clf, method='isotonic')
clf_fit = clf_c.fit(X_train, y_train)
y_pred = clf_fit.predict_proba(X_test)[:, 1]
assert(np.all(y_pred >= 0))
assert(np.all(y_pred <= 1))


def test_calibration_curve():
"""Check calibration_curve function"""
y_true = np.array([0, 0, 0, 1, 1, 1])
Expand Down