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.

warray-like, shape (n_samples) or (n_samples, n_annotators),
default=np.ones_like(y)

Class label weights.

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

Holds the label for each class.

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

Value to represent a missing label.

random_stateint, RandomState instance or None, optional (default=None)

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

Returns
y_aggregatedarray-like, shape (n_samples)

Assigned labels for each sample.