Skip to content
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

[MRG] Expose interpolation thresholds as public fitted attribute of IsotonicRegression #16289

Merged
merged 32 commits into from Jun 25, 2020
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
ea6de9f
Change interpolation point to attribute
kishimoto-banana Jan 29, 2020
78e9e58
Rename variables and fix explanation
kishimoto-banana Jan 30, 2020
c5a195b
Add backward compatibility
kishimoto-banana Jan 30, 2020
d2d52fd
Add version number
kishimoto-banana Jan 31, 2020
c858e42
Follow PEP8
kishimoto-banana Jan 31, 2020
fdcd934
Rename and delete the old attributes
kishimoto-banana Jan 31, 2020
962ba46
Remove redundant statement
kishimoto-banana Jan 31, 2020
86bbdc7
Add plot of the learned decision thresholds
ogrisel Feb 2, 2020
ce539f4
Cosmit
ogrisel Feb 2, 2020
d901330
Add test for new public thresholds
ogrisel Feb 2, 2020
f542cf9
Add test for public thresholds attributes
ogrisel Feb 2, 2020
b4d218d
Add entry to what's new
ogrisel Feb 2, 2020
0c14147
Trigger CI (to updated codecov)
ogrisel Feb 7, 2020
769062e
Add test for pickle compat
ogrisel Feb 7, 2020
646bb03
Simpler threshold test: X_thresolds are strictly increasing
ogrisel Feb 7, 2020
ff00e2c
[ci skip] fix phrasing in example
ogrisel Feb 7, 2020
072097a
Merge remote-tracking branch 'upstream/master' into pr/16289
thomasjpfan Mar 11, 2020
a0fe7f6
TST Asserts _necessary_X_ is removed from unpickled obj
thomasjpfan Mar 11, 2020
ddc2f92
Update examples/plot_isotonic_regression.py
ogrisel Mar 22, 2020
0dee14a
Update sklearn/isotonic.py
kishimoto-banana Mar 27, 2020
77ad922
Apply suggestions from code review
ogrisel Jun 23, 2020
c4ecd41
Remove pickling backward compat
ogrisel Jun 23, 2020
bc83c4f
Merge remote-tracking branch 'origin/master' into not-internal-use
ogrisel Jun 23, 2020
a12df20
Update changelog
ogrisel Jun 23, 2020
904a764
Add versionadded directives to docstring
ogrisel Jun 23, 2020
38bc370
Fix pickling of unfitted estimator
ogrisel Jun 23, 2020
3fb5ee6
Fix unused import
ogrisel Jun 23, 2020
24b18a6
Fix parameter docstring
ogrisel Jun 23, 2020
6514182
Use default color scheme and show extrapolation in the plot
ogrisel Jun 23, 2020
71a1da6
Use a third color for the linear fit
ogrisel Jun 23, 2020
a86e868
Apply suggestions from code review
ogrisel Jun 25, 2020
5902352
Separators + isotonic assumption in example
ogrisel Jun 25, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 12 additions & 5 deletions sklearn/isotonic.py
Expand Up @@ -190,6 +190,12 @@ class IsotonicRegression(RegressorMixin, TransformerMixin, BaseEstimator):
X_max_ : float
Maximum value of input array `X_` for right bound.

interpolation_X_ : array-like of shape (n_interpolation_points,)
ogrisel marked this conversation as resolved.
Show resolved Hide resolved
Interpolation point of `X`.

interpolation_y_ : array-like of shape (n_interpolation_points,)
Interpolation point of `y`.
ogrisel marked this conversation as resolved.
Show resolved Hide resolved

f_ : function
The stepwise interpolating function that covers the input domain ``X``.

Expand Down Expand Up @@ -339,7 +345,7 @@ def fit(self, X, y, sample_weight=None):
# on the model to make it possible to support model persistence via
# the pickle module as the object built by scipy.interp1d is not
# picklable directly.
self._necessary_X_, self._necessary_y_ = X, y
self.interpolation_X_, self.interpolation_y_ = X, y

# Build the interpolation function
self._build_f(X, y)
Expand All @@ -359,8 +365,8 @@ def transform(self, T):
The transformed data
"""

if hasattr(self, '_necessary_X_'):
dtype = self._necessary_X_.dtype
if hasattr(self, 'interpolation_X_'):
dtype = self.interpolation_X_.dtype
else:
dtype = np.float64

Expand Down Expand Up @@ -413,8 +419,9 @@ def __setstate__(self, state):
We need to rebuild the interpolation function.
"""
super().__setstate__(state)
if hasattr(self, '_necessary_X_') and hasattr(self, '_necessary_y_'):
self._build_f(self._necessary_X_, self._necessary_y_)
ogrisel marked this conversation as resolved.
Show resolved Hide resolved
if hasattr(self, 'interpolation_X_') and hasattr(
self, 'interpolation_y_'):
self._build_f(self.interpolation_X_, self.interpolation_y_)

def _more_tags(self):
return {'X_types': ['1darray']}