fuzzyclust.semisupervised.make_partial_labels#

fuzzyclust.semisupervised.make_partial_labels(y, fraction=0.1, n_labeled=None, random_state=None)[source]#

Hide most labels of y: keep a random subset, set the rest to -1.

Parameters:
yarray_like of shape (n_samples,)
fractionfloat, default=0.1

Share of the samples that keep their label (ignored if n_labeled is given).

n_labeledint, optional

Exact number of labeled samples. At least one sample of every class keeps its label whenever the budget allows it.

random_stateint, RandomState instance or None
Returns:
y_partialndarray of shape (n_samples,)

y with -1 at the hidden positions.

Examples

>>> import numpy as np
>>> from fuzzyclust.semisupervised import make_partial_labels
>>> yp = make_partial_labels(np.repeat([0, 1, 2], 50), fraction=0.1, random_state=0)
>>> int((yp >= 0).sum())
15

Examples using fuzzyclust.semisupervised.make_partial_labels#

Fuzzy c-means with partial supervision: label fraction and weight

Fuzzy c-means with partial supervision: label fraction and weight