From 7b4991fc74f28b98eb27255dfcae9882935512a1 Mon Sep 17 00:00:00 2001 From: veerlosar Date: Thu, 2 May 2019 16:57:08 +0200 Subject: [PATCH 1/3] add examplt to IsotonicRegression class --- sklearn/isotonic.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sklearn/isotonic.py b/sklearn/isotonic.py index 3b8f74a946699..9663a1a9db699 100644 --- a/sklearn/isotonic.py +++ b/sklearn/isotonic.py @@ -209,7 +209,18 @@ class IsotonicRegression(BaseEstimator, TransformerMixin, RegressorMixin): Correctness of Kruskal's algorithms for monotone regression with ties Leeuw, Psychometrica, 1977 + + + Examples + -------- + >>> from sklearn.datasets import make_regression + >>> from sklearn.isotonic import IsotonicRegression + >>> X, y = make_regression(n_samples=10, n_features=1) + >>> iso_reg = IsotonicRegression().fit(X.flatten(), y) + >>> iso_reg.predict([.1, .2]) # doctest: +ELLIPSIS + array([2.4301..., 4.8603...]) """ + def __init__(self, y_min=None, y_max=None, increasing=True, out_of_bounds='nan'): self.y_min = y_min From 569bc4fc15c143fec0766a27f296d8883224adea Mon Sep 17 00:00:00 2001 From: veerlosar Date: Thu, 2 May 2019 17:49:58 +0200 Subject: [PATCH 2/3] removed a line --- sklearn/isotonic.py | 1 - 1 file changed, 1 deletion(-) diff --git a/sklearn/isotonic.py b/sklearn/isotonic.py index 9663a1a9db699..962d82207bb47 100644 --- a/sklearn/isotonic.py +++ b/sklearn/isotonic.py @@ -210,7 +210,6 @@ class IsotonicRegression(BaseEstimator, TransformerMixin, RegressorMixin): Correctness of Kruskal's algorithms for monotone regression with ties Leeuw, Psychometrica, 1977 - Examples -------- >>> from sklearn.datasets import make_regression From 6005a7d4d296ba7450b81b542c4cd671e9ee9a02 Mon Sep 17 00:00:00 2001 From: veerlosar Date: Thu, 2 May 2019 18:47:41 +0200 Subject: [PATCH 3/3] fixed random issue --- sklearn/isotonic.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sklearn/isotonic.py b/sklearn/isotonic.py index 962d82207bb47..7cff336715322 100644 --- a/sklearn/isotonic.py +++ b/sklearn/isotonic.py @@ -214,12 +214,11 @@ class IsotonicRegression(BaseEstimator, TransformerMixin, RegressorMixin): -------- >>> from sklearn.datasets import make_regression >>> from sklearn.isotonic import IsotonicRegression - >>> X, y = make_regression(n_samples=10, n_features=1) + >>> X, y = make_regression(n_samples=10, n_features=1, random_state=41) >>> iso_reg = IsotonicRegression().fit(X.flatten(), y) >>> iso_reg.predict([.1, .2]) # doctest: +ELLIPSIS - array([2.4301..., 4.8603...]) + array([1.8628..., 3.7256...]) """ - def __init__(self, y_min=None, y_max=None, increasing=True, out_of_bounds='nan'): self.y_min = y_min