DOC Fix doc of defaults in sklearn.utils.multiclass.py
@@ -40,7 +40,7 @@ _FN_UNIQUE_LABELS = {
def unique_labels(*ys):
- """Extract an ordered array of unique labels
+ """Extract an ordered array of unique labels.
We don't allow:
- mix of multilabel and multiclass (single label) targets
@@ -57,7 +57,7 @@ def unique_labels(*ys):
Returns
-------
- out : numpy array of shape [n_unique_labels]
+ out : ndarray of shape (n_unique_labels,)
An ordered array of unique labels.
Examples
@@ -114,12 +114,12 @@ def is_multilabel(y):
Parameters
----------
- y : numpy array of shape [n_samples]
+ y : ndarray of shape (n_samples,)
Target values.
Returns
-------
- out : bool,
+ out : bool
Return ``True``, if ``y`` is in a multilabel format, else ```False``.
Examples
@@ -190,7 +190,7 @@ def type_of_target(y):
Returns
-------
- target_type : string
+ target_type : str
One of:
* 'continuous': `y` is an array-like of floats that are not all
@@ -290,7 +290,7 @@ def type_of_target(y):
def _check_partial_fit_first_call(clf, classes=None):
- """Private helper function for factorizing common classes param logic
+ """Private helper function for factorizing common classes param logic.
Estimators that implement the ``partial_fit`` API need to be provided with
the list of possible classes at the first call to partial_fit.
@@ -325,11 +325,11 @@ def _check_partial_fit_first_call(clf, classes=None):
def class_distribution(y, sample_weight=None):
- """Compute class priors from multioutput-multiclass target data
+ """Compute class priors from multioutput-multiclass target data.
Parameters
----------
- y : array like or sparse matrix of size (n_samples, n_outputs)
+ y : {array-like, sparse matrix} of size (n_samples, n_outputs)
The labels for each example.
sample_weight : array-like of shape (n_samples,), default=None
@@ -337,13 +337,13 @@ def class_distribution(y, sample_weight=None):
Returns
-------
- classes : list of size n_outputs of arrays of size (n_classes,)
+ classes : list of size n_outputs of ndarray of size (n_classes,)
List of classes for each column.
- n_classes : list of integers of size n_outputs
- Number of classes in each column
+ n_classes : list of int of size n_outputs
+ Number of classes in each column.
- class_prior : list of size n_outputs of arrays of size (n_classes,)
+ class_prior : list of size n_outputs of ndarray of size (n_classes,)
Class distribution of each column.
"""
@@ -408,16 +408,16 @@ def _ovr_decision_function(predictions, confidences, n_classes):
Parameters
----------
- predictions : array-like, shape (n_samples, n_classifiers)
+ predictions : array-like of shape (n_samples, n_classifiers)
Predicted classes for each binary classifier.
- confidences : array-like, shape (n_samples, n_classifiers)
+ confidences : array-like of shape (n_samples, n_classifiers)
Decision functions or predicted probabilities for positive class
for each binary classifier.
n_classes : int
Number of classes. n_classifiers must be
- ``n_classes * (n_classes - 1 ) / 2``
+ ``n_classes * (n_classes - 1 ) / 2``.
"""
n_samples = predictions.shape[0]
votes = np.zeros((n_samples, n_classes))
