Confidence score. Parameters ---------- X : array-like of shape (n_samples, n_features) The input data. Returns ------- decision : ndarray of shape (n_samples,) if n_classes == 2\ else (n_samples, n_classes) Co
(self, X)
| 282 | return proba |
| 283 | |
| 284 | def decision_function(self, X): |
| 285 | """Confidence score. |
| 286 | |
| 287 | Parameters |
| 288 | ---------- |
| 289 | X : array-like of shape (n_samples, n_features) |
| 290 | The input data. |
| 291 | |
| 292 | Returns |
| 293 | ------- |
| 294 | decision : ndarray of shape (n_samples,) if n_classes == 2\ |
| 295 | else (n_samples, n_classes) |
| 296 | Confidence score. |
| 297 | """ |
| 298 | if ( |
| 299 | self.methods_to_check == "all" |
| 300 | or "decision_function" in self.methods_to_check |
| 301 | ): |
| 302 | X, y = self._check_X_y(X) |
| 303 | rng = check_random_state(self.random_state) |
| 304 | if len(self.classes_) == 2: |
| 305 | # for binary classifier, the confidence score is related to |
| 306 | # classes_[1] and therefore should be null. |
| 307 | return rng.randn(_num_samples(X)) |
| 308 | else: |
| 309 | return rng.randn(_num_samples(X), len(self.classes_)) |
| 310 | |
| 311 | def score(self, X=None, Y=None): |
| 312 | """Fake score. |