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
ofshape(n_samples,) - fraction
float, default=0.1 Share of the samples that keep their label (ignored if
n_labeledis given).- n_labeled
int,optional Exact number of labeled samples. At least one sample of every class keeps its label whenever the budget allows it.
- random_state
int,RandomStateinstanceorNone
- yarray_like
- Returns:
- y_partial
ndarrayofshape(n_samples,) ywith-1at the hidden positions.
- y_partial
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