| bag_instance_sampling | R Documentation |
mild_df object by bags and instancesFrom a mild_df object, return a sample that evenly pulls from the unique
bags and unique instances from each bag as much as possible. This is a form
of stratified sampling to avoid randomly sampling many rows from a few bags.
bag_instance_sampling(data, size)
data |
A |
size |
A non-negative integer giving the number of rows to choose from
|
A numeric vector of length size indicating which rows were sampled.
Sean Kent
mil_data <- generate_mild_df(positive_dist = "mvnormal",
nbag = 2,
ninst = 2,
nsample = 2)
rows <- bag_instance_sampling(mil_data, 6)
table(mil_data$bag_name[rows])
table(mil_data$instance_name[rows])
rows <- bag_instance_sampling(mil_data, 4)
table(mil_data$bag_name[rows])
table(mil_data$instance_name[rows])
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.