label_cardinality_inconsistency#

skactiveml.pool.label_cardinality_inconsistency(y_pred, y_labeled)[source]#

Calculate the label cardinality inconsistency.

The label cardinality of a sample is its number of positive labels. This acquisition function scores each candidate sample by the absolute difference between its predicted label cardinality and the mean label cardinality of the labeled samples [1]. An empty labeled pool is treated as having a label cardinality of zero.

Both targets must be encoded, i.e., 0 for the negative and 1 for the positive class of each output, so that the acquisition function performs no arithmetic on raw class values. Use skactiveml.utils.ExtLabelEncoder with target_type=”multi-label” to encode raw class vocabularies.

Parameters:
y_predarray-like of shape (n_candidates, n_outputs)

Encoded predicted labels of the candidate samples.

y_labeledarray-like of shape (n_labeled, n_outputs)

Encoded observed labels of the labeled samples. May be empty, i.e., of shape (0, n_outputs).

Returns:
utilitiesnumpy.ndarray of shape (n_candidates,)

Absolute difference between each candidate’s predicted label cardinality and the mean label cardinality of the labeled samples, i.e., one finite value in [0, n_outputs] per candidate. Larger values indicate more useful candidates.

Raises:
ValueError

If y_pred or y_labeled is not a two-dimensional array with n_outputs columns, or if either contains values other than 0 and 1, e.g., unlabeled rows or raw class values.

References

[1]

R. Wang and S. Ye (2019). Multi-Label Active Learning Driven by Uncertainty and Inconsistency. In 2019 International Conference on Machine Learning and Cybernetics.