8000 DOC address Joel's comments on model_evaluation.rst · scikit-learn/scikit-learn@970a513 · GitHub
[go: up one dir, main page]

Skip to content

Commit 970a513

Browse files
committed
DOC address Joel's comments on model_evaluation.rst
1 parent 3a5db31 commit 970a513

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

doc/modules/model_evaluation.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -242,14 +242,14 @@ permitted and will require a wrapper to return a single metric::
242242
>>> # A sample toy binary classification dataset
243243
>>> X, y = datasets.make_classification(n_classes=2, random_state=0)
244244
>>> svm = LinearSVC(random_state=0)
245-
>>> tp = lambda y_true, y_pred: confusion_matrix(y_true, y_pred)[0, 0]
246-
>>> tn = lambda y_true, y_pred: confusion_matrix(y_true, y_pred)[0, 0]
247-
>>> fp = lambda y_true, y_pred: confusion_matrix(y_true, y_pred)[1, 0]
248-
>>> fn = lambda y_true, y_pred: confusion_matrix(y_true, y_pred)[0, 1]
245+
>>> def tp(y_true, y_pred): confusion_matrix(y_true, y_pred)[0, 0]
246+
>>> def tn(y_true, y_pred): confusion_matrix(y_true, y_pred)[0, 0]
247+
>>> def fp(y_true, y_pred): confusion_matrix(y_true, y_pred)[1, 0]
248+
>>> def fn(y_true, y_pred): confusion_matrix(y_true, y_pred)[0, 1]
249249
>>> scoring = {'tp' : make_scorer(tp), 'tn' : make_scorer(tn),
250250
... 'fp' : make_scorer(fp), 'fn' : make_scorer(fn)}
251251
>>> cv_results = cross_validate(svm.fit(X, y), X, y, scoring=scoring)
252-
>>> # Getting the test set false positive scores
252+
>>> # Getting the test set true positive scores
253253
>>> print(cv_results['test_tp']) # doctest: +NORMALIZE_WHITESPACE
254254
[12 13 15]
255255
>>> # Getting the test set false negative scores

0 commit comments

Comments
 (0)
0