8000 Merge pull request #1366 from agramfort/move_isotonic · ludgate/scikit-learn@9432b4e · GitHub
[go: up one dir, main page]

Skip to content

Commit 9432b4e

Browse files
committed
Merge pull request scikit-learn#1366 from agramfort/move_isotonic
API : move isotonic regression out of linear_model
2 parents 2468cbf + dcbddc7 commit 9432b4e

File tree

11 files changed

+57
-30
lines changed

11 files changed

+57
-30
lines changed

doc/modules/classes.rst

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,6 +434,30 @@ From text
434434
hmm.MultinomialHMM
435435
hmm.GMMHMM
436436

437+
.. _isotonic_ref:
438+
439+
:mod:`sklearn.isotonic`: Isotonic regression
440+
============================================
441+
442+
.. automodule:: sklearn.isotonic
443+
:no-members:
444+
:no-inherited-members:
445+
446+
**User guide:** See the :ref:`isotonic` section for further details.
447+
448+
.. currentmodule:: sklearn
449+
450+
.. autosummary::
451+
:toctree: generated/
452+
:template: class.rst
453+
454+
isotonic.IsotonicRegression
455+
456+
.. autosummary::
457+
:toctree: generated
458+
:template: function.rst
459+
460+
isotonic.isotonic_regression
437461

438462
.. _kernel_approximation_ref:
439463

@@ -515,7 +539,6 @@ From text
515539
linear_model.BayesianRidge
516540
linear_model.ElasticNet
517541
linear_model.ElasticNetCV
518-
linear_model.IsotonicRegression
519542
linear_model.Lars
520543
linear_model.LarsCV
521544
linear_model.Lasso
@@ -544,7 +567,6 @@ From text
544567
:toctree: generated/
545568
:template: function.rst
546569

547-
linear_model.isotonic_regression
548570
linear_model.lars_path
549571
linear_model.lasso_path
550572
linear_model.lasso_stability_path

doc/modules/isotonic.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.. _isotonic:
2+
3+
===================
4+
Isotonic regression
5+
===================
6+
7+
.. currentmodule:: sklearn.isotonic
8+
9+
The :class:`IsotonicRegression` fits a non-decreasing function to the data.
10+
It solves the following problem:
11+
12+
minimize :math:`\sum_i w_i (y_i - \hat{y}_i)^2`
13+
14+
subject to :math:`\hat{y}_{min} = \hat{y}_1 \le \hat{y}_2 ... \le \hat{y}_n = \hat{y}_{max}`
15+
16+
where each :math:`w_i` is strictly positive and each :math:`y_i` is an
17+
arbitrary real number. It yields the vector which is composed of non-decreasing
18+
elements the closest in terms of mean squared error. In practice this list
19+
of elements forms a function that is piecewise linear.
20+
21+
.. figure:: ../auto_examples/linear_model/images/plot_isotonic_regression_1.png
22+
:target: ../auto_examples/linear_model/images/plot_isotonic_regression.html
23+
:align: center

doc/modules/linear_model.rst

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -657,25 +657,6 @@ zero) model.
657657
thus be used to perform feature selection, as detailed in
658658
:ref:`l1_feature_selection`.
659659

660-
Isotonic regression
661-
====================
662-
663-
The :class:`IsotonicRegression` fits a non-decreasing function to the data.
664-
It solves the following problem:
665-
666-
minimize :math:`\sum_i w_i (y_i - \hat{y}_i)^2`
667-
668-
subject to :math:`\hat{y}_{min} = \hat{y}_1 \le \hat{y}_2 ... \le \hat{y}_n = \hat{y}_{max}`
669-
670-
where each :math:`w_i` is strictly positive and each :math:`y_i` is an
671-
arbitrary real number. It yields the vector which is composed of non-decreasing
672-
elements the closest in terms of mean squared error. In practice this list
673-
of elements forms a function that is piecewise linear.
674-
675-
.. figure:: ../auto_examples/linear_model/images/plot_isotonic_regression_1.png
676-
:target: ../auto_examples/linear_model/images/plot_isotonic_regression.html
677-
:align: center
678-
679660
Stochastic Gradient Descent - SGD
680661
=================================
681662

doc/supervised_learning.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ Supervised learning
2020
modules/feature_selection.rst
2121
modules/label_propagation.rst
2222
modules/lda_qda.rst
23+
modules/isotonic.rst

examples/linear_model/plot_isotonic_regression.py renamed to examples/plot_isotonic_regression.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
import pylab as pl
2121
from matplotlib.collections import LineCollection
2222

23-
from sklearn.linear_model import IsotonicRegression, LinearRegression
23+
from sklearn.linear_model import LinearRegression
24+
from sklearn.isotonic import IsotonicRegression
2425
from sklearn.utils import check_random_state
2526

2627
n = 100

sklearn/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def test(self, label='fast', verbose=1, extra_argv=['--exe'],
6767
'feature_selection', 'semi_supervised',
6868
'gaussian_process', 'grid_search', 'hmm', 'lda', 'linear_model',
6969
'metrics', 'mixture', 'naive_bayes', 'neighbors', 'pipeline',
70-
'preprocessing', 'qda', 'svm', 'test', 'clone', 'pls']
70+
'preprocessing', 'qda', 'svm', 'test', 'clone', 'pls',
71+
'isotonic']
7172

7273

7374
def setup_module(module):

sklearn/linear_model/isotonic_regression_.py renamed to sklearn/isotonic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
import numpy as np
77
from scipy import interpolate
8-
from ..base import BaseEstimator, TransformerMixin, RegressorMixin
9-
from ..utils import as_float_array, check_arrays
8+
from .base import BaseEstimator, TransformerMixin, RegressorMixin
9+
from .utils import as_float_array, check_arrays
1010

1111

1212
def isotonic_regression(y, weight=None, y_min=None, y_max=None):

sklearn/linear_model/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
from .perceptron import Perceptron
2929
from .randomized_l1 import RandomizedLasso, RandomizedLogisticRegression, \
3030
lasso_stability_path
31-
from .isotonic_regression_ import IsotonicRegression, isotonic_regression
3231

3332
__all__ = ['ARDRegression',
3433
'BayesianRidge',

sklearn/manifold/mds.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from ..utils import check_random_state, check_arrays
1515
from ..externals.joblib import Parallel
1616
from ..externals.joblib import delayed
17-
from ..linear_model.isotonic_regression_ import isotonic_regression
17+
from ..isotonic import isotonic_regression
1818

1919

2020
def _smacof_single(similarities, metric=True, n_components=2, init=None,

sklearn/tests/test_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
Normalizer, OneHotEncoder
5151
from sklearn.cluster import WardAgglomeration, AffinityPropagation, \
5252
SpectralClustering
53-
from sklearn.linear_model import IsotonicRegression
53+
from sklearn.isotonic import IsotonicRegression
5454

5555
dont_test = [Pipeline, FeatureUnion, GridSearchCV, SparseCoder,
5656
EllipticEnvelope, EllipticEnvelop, DictVectorizer, LabelBinarizer,

0 commit comments

Comments
 (0)
0