Skip to content

[MRG +1] DOC Modify documentation/examples for the new model_selection module #5566

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

Merged
merged 1 commit into from
Oct 30, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 6 additions & 7 deletions doc/developers/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ adheres to the scikit-learn interface and standards by running

The main motivation to make a class compatible to the scikit-learn estimator
interface might be that you want to use it together with model assessment and
selection tools such as :class:`grid_search.GridSearchCV`.
selection tools such as :class:`model_selection.GridSearchCV`.

For this to work, you need to implement the following interface.
If a dependency on scikit-learn is okay for your code,
Expand Down Expand Up @@ -856,7 +856,7 @@ implement the interface is::

Parameters and init
-------------------
As :class:`grid_search.GridSearchCV` uses ``set_params``
As :class:`model_selection.GridSearchCV` uses ``set_params``
to apply parameter setting to estimators,
it is essential that calling ``set_params`` has the same effect
as setting parameters using the ``__init__`` method.
Expand All @@ -874,9 +874,8 @@ trailing ``_`` is used to check if the estimator has been fitted.

Cloning
-------
For using :class:`grid_search.GridSearch` or any functionality of the
:mod:`cross_validation` module, an estimator must support the ``base.clone``
function to replicate an estimator.
For use with the :mod:`model_selection` module,
an estimator must support the ``base.clone`` function to replicate an estimator.
This can be done by providing a ``get_params`` method.
If ``get_params`` is present, then ``clone(estimator)`` will be an instance of
``type(estimator)`` on which ``set_params`` has been called with clones of
Expand All @@ -901,8 +900,8 @@ accepts an optional ``y``.
Estimator types
---------------
Some common functionality depends on the kind of estimator passed.
For example, cross-validation in :class:`grid_search.GridSearchCV` and
:func:`cross_validation.cross_val_score` defaults to being stratified when used
For example, cross-validation in :class:`model_selection.GridSearchCV` and
:func:`model_selection.cross_val_score` defaults to being stratified when used
on a classifier, but not otherwise. Similarly, scorers for average precision
that take a continuous prediction need to call ``decision_function`` for classifiers,
but ``predict`` for regressors. This distinction between classifiers and regressors
Expand Down
1 change: 0 additions & 1 deletion doc/model_selection.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,3 @@ Model selection and evaluation
modules/grid_search
modules/model_evaluation
modules/model_persistence
modules/learning_curve
116 changes: 53 additions & 63 deletions doc/modules/classes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -144,45 +144,76 @@ Classes
covariance.graph_lasso


.. _cross_validation_ref:

:mod:`sklearn.cross_validation`: Cross Validation
=================================================
:mod:`sklearn.model_selection`: Model Selection
===============================================

.. automodule:: sklearn.cross_validation
.. automodule:: sklearn.model_selection
:no-members:
:no-inherited-members:

**User guide:** See the :ref:`cross_validation` section for further details.
**User guide:** See the :ref:`cross_validation`, :ref:`grid_search` and
:ref:`learning_curve` sections for further details.

Splitter Classes
----------------

.. currentmodule:: sklearn

.. autosummary::
:toctree: generated/
:template: class.rst

model_selection.KFold
model_selection.LabelKFold
model_selection.StratifiedKFold
model_selection.LeaveOneLabelOut
model_selection.LeavePLabelOut
model_selection.LeaveOneOut
model_selection.LeavePOut
model_selection.ShuffleSplit
model_selection.LabelShuffleSplit
model_selection.StratifiedShuffleSplit
model_selection.PredefinedSplit

Splitter Functions
------------------

.. currentmodule:: sklearn

.. autosummary::
:toctree: generated/
:template: function.rst

model_selection.train_test_split
Copy link
Member

Choose a reason for hiding this comment

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

I would put this in the section above.

Copy link
Member Author

Choose a reason for hiding this comment

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

This one has a function template and that one is a class template... So I renamed the headings to "splitter classes" and "splitter functions" I hope that is fine?


Hyper-parameter optimizers
--------------------------

.. currentmodule:: sklearn

.. autosummary::
:toctree: generated/
:template: class.rst

cross_validation.KFold
cross_validation.LabelKFold
cross_validation.LabelShuffleSplit
cross_validation.LeaveOneLabelOut
cross_validation.LeaveOneOut
cross_validation.LeavePLabelOut
cross_validation.LeavePOut
cross_validation.PredefinedSplit
cross_validation.ShuffleSplit
cross_validation.StratifiedKFold
cross_validation.StratifiedShuffleSplit
model_selection.GridSearchCV
model_selection.RandomizedSearchCV
model_selection.ParameterGrid
model_selection.ParameterSampler

Model validation
----------------

.. currentmodule:: sklearn

.. autosummary::
:toctree: generated/
:template: function.rst

cross_validation.train_test_split
cross_validation.cross_val_score
cross_validation.cross_val_predict
cross_validation.permutation_test_score
cross_validation.check_cv
model_selection.cross_val_score
model_selection.cross_val_predict
model_selection.permutation_test_score
model_selection.learning_curve
model_selection.validation_curve

.. _datasets_ref:

Expand Down Expand Up @@ -547,29 +578,6 @@ Kernels:
gaussian_process.kernels.CompoundKernel
gaussian_process.kernels.Hyperparameter

.. _grid_search_ref:

:mod:`sklearn.grid_search`: Grid Search
=======================================

.. automodule:: sklearn.grid_search
:no-members:
:no-inherited-members:

**User guide:** See the :ref:`grid_search` section for further details.

.. currentmodule:: sklearn

.. autosummary::
:toctree: generated/
:template: class.rst

grid_search.GridSearchCV
grid_search.ParameterGrid
grid_search.ParameterSampler
grid_search.RandomizedSearchCV


.. _isotonic_ref:

:mod:`sklearn.isotonic`: Isotonic regression
Expand Down Expand Up @@ -658,24 +666,6 @@ Kernels:
discriminant_analysis.QuadraticDiscriminantAnalysis


.. _learning_curve_ref:

:mod:`sklearn.learning_curve` Learning curve evaluation
=======================================================

.. automodule:: sklearn.learning_curve
:no-members:
:no-inherited-members:

.. currentmodule:: sklearn

.. autosummary::
:toctree: generated/
:template: function.rst

learning_curve.learning_curve
learning_curve.validation_curve

.. _linear_model_ref:

:mod:`sklearn.linear_model`: Generalized Linear Models
Expand Down
Loading