@@ -242,14 +242,14 @@ permitted and will require a wrapper to return a single metric::
242
242
>>> # A sample toy binary classification dataset
243
243
>>> X, y = datasets.make_classification(n_classes=2, random_state=0)
244
244
>>> 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]
249
249
>>> scoring = {'tp' : make_scorer(tp), 'tn' : make_scorer(tn),
250
250
... 'fp' : make_scorer(fp), 'fn' : make_scorer(fn)}
251
251
>>> 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
253
253
>>> print(cv_results['test_tp']) # doctest: +NORMALIZE_WHITESPACE
254
254
[12 13 15]
255
255
>>> # Getting the test set false negative scores
0 commit comments