Make predictions using a single binary estimator.
(estimator, X)
| 104 | |
| 105 | |
| 106 | def _predict_binary(estimator, X): |
| 107 | """Make predictions using a single binary estimator.""" |
| 108 | if is_regressor(estimator): |
| 109 | return estimator.predict(X) |
| 110 | try: |
| 111 | score = np.ravel(estimator.decision_function(X)) |
| 112 | except (AttributeError, NotImplementedError): |
| 113 | # probabilities of the positive class |
| 114 | score = estimator.predict_proba(X)[:, 1] |
| 115 | return score |
| 116 | |
| 117 | |
| 118 | def _threshold_for_binary_predict(estimator): |
no test coverage detected
searching dependent graphs…