MCPcopy
hub / github.com/scikit-learn/scikit-learn / decision_function

Method decision_function

sklearn/multiclass.py:565–592  ·  view source on GitHub ↗

Decision function for the OneVsRestClassifier. Return the distance of each sample from the decision boundary for each class. This can only be used with estimators which implement the `decision_function` method. Parameters ---------- X : array-like of

(self, X)

Source from the content-addressed store, hash-verified

563
564 @available_if(_estimators_has("decision_function"))
565 def decision_function(self, X):
566 """Decision function for the OneVsRestClassifier.
567
568 Return the distance of each sample from the decision boundary for each
569 class. This can only be used with estimators which implement the
570 `decision_function` method.
571
572 Parameters
573 ----------
574 X : array-like of shape (n_samples, n_features)
575 Input data.
576
577 Returns
578 -------
579 T : array-like of shape (n_samples, n_classes) or (n_samples,) for \
580 binary classification.
581 Result of calling `decision_function` on the final estimator.
582
583 .. versionchanged:: 0.19
584 output shape changed to ``(n_samples,)`` to conform to
585 scikit-learn conventions for binary classification.
586 """
587 check_is_fitted(self)
588 if len(self.estimators_) == 1:
589 return self.estimators_[0].decision_function(X)
590 return np.array(
591 [est.decision_function(X).ravel() for est in self.estimators_]
592 ).T
593
594 @property
595 def multilabel_(self):

Calls 2

check_is_fittedFunction · 0.90
decision_functionMethod · 0.45