generate_labels: Generate random labels

Description Usage Arguments Details Value See Also Examples

View source: R/generate_labels.R

Description

Function to generate a vector of random labels

Usage

1
generate_labels(n, pos_rate)

Arguments

n

number of labels to be generated

pos_rate

rate of expected positive labels

Details

This function generates "n" random labels in -1, 1 drawn from the binomial distribution B(n, pos_rate)

Value

-1/1 vector of length "n" containing the generated labels

See Also

generate_points

Examples

1
2
3
4
5
pos_rate <- 0.3;					
n <- 100;
## generating n random labels with 0.3 expected rate of positive labels
random_labels <- generate_labels(n, pos_rate);
sum(random_labels > 0);

COSNet documentation built on Nov. 8, 2020, 8:12 p.m.