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

Skip to content

Commit fbca098

Browse files
jrbourbeauagramfort
authored andcommitted
Modifies model_selection.cross_validate docstring (#9534)
- Fixes rendering of docstring examples - Instead of importing cross_val_score in example, cross_validate is imported
1 parent 88f529e commit fbca098

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

sklearn/model_selection/_validation.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ def cross_validate(estimator, X, y=None, groups=None, scoring=None, cv=None,
144144
Examples
145145
--------
146146
>>> from sklearn import datasets, linear_model
147-
>>> from sklearn.model_selection import cross_val_score
147+
>>> from sklearn.model_selection import cross_validate
148148
>>> from sklearn.metrics.scorer import make_scorer
149149
>>> from sklearn.metrics import confusion_matrix
150150
>>> from sklearn.svm import LinearSVC
@@ -153,15 +153,17 @@ def cross_validate(estimator, X, y=None, groups=None, scoring=None, cv=None,
153153
>>> y = diabetes.target[:150]
154154
>>> lasso = linear_model.Lasso()
155155
156-
# single metric evaluation using cross_validate
156+
Single metric evaluation using ``cross_validate``
157+
157158
>>> cv_results = cross_validate(lasso, X, y, return_train_score=False)
158159
>>> sorted(cv_results.keys()) # doctest: +ELLIPSIS
159160
['fit_time', 'score_time', 'test_score']
160161
>>> cv_results['test_score'] # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
161162
array([ 0.33..., 0.08..., 0.03...])
162163
163-
# Multiple metric evaluation using cross_validate
164-
# (Please refer the ``scoring`` parameter doc for more information)
164+
Multiple metric evaluation using ``cross_validate``
165+
(please refer the ``scoring`` parameter doc for more information)
166+
165167
>>> scores = cross_validate(lasso, X, y,
166168
... scoring=('r2', 'neg_mean_squared_error'))
167169
>>> print(scores['test_neg_mean_squared_error']) # doctest: +ELLIPSIS

0 commit comments

Comments
 (0)