skactiveml.utils.majority_vote#

skactiveml.utils.majority_vote(y, w=None, classes=None, missing_label=nan, random_state=None)[source]#

Assigns a label to each sample based on weighted voting. Samples with no labels are assigned with missing_label.

Parameters
yarray-like, shape (n_samples,) or (n_samples, n_annotators)

Class labels, which may contain also missing labels.

warray-like, shape (n_samples) or (n_samples, n_annotators) or None, default=None

Class label weights. If the weights are None, weights are assumed to be equal for every sample.

classesarray-like of shape (n_classes,), default=None

Holds the label for each class.

missing_labelscalar or string or np.nan or None, default=np.nan

Value to represent a missing label.

random_stateint or RandomState instance or None, default=None

Determines random number generation for shuffling the data. Pass an int for reproducible results across multiple function calls.

Returns
y_aggregatednumpy.ndarray of shape (n_samples,)

Assigned labels for each sample.