Turn any labeled binary dataset into a positive-unlabeled one under the
SCAR assumption: each positive stays labeled with constant probability
label_propensity and the rest become unlabeled. This is how the PU
literature builds benchmarks from open binary datasets — positives of
the known class remain 1, hidden positives and negatives pool as 0.
Arguments
- z
Binary vector of true labels (
1positive,0negative).- label_propensity
Constant probability that a true positive is observed as a labeled positive, in
(0, 1].- seed
Optional nonnegative integer seed. Use a different seed than the one that generated
z— reusing the same stream can correlate the mask with the simulated labels.