mild_df: Build a MILD data frame

View source: R/mild_df.R

mild_dfR Documentation

Build a MILD data frame

Description

mild_df() constructs a data frame that corresponds to Multiple Instance Learning with Distributional Instances (MILD) data. A mild_df object must have three special columns:

  • bag_label, determines the label of each bag, typically from c(0, 1)

  • bag_name, character or factor that specifies the bag that each sample belongs to.

  • instance_name, character or factor that specifies the instance that each sample belongs to.

Usage

mild_df(
  bag_label = character(),
  bag_name = character(),
  instance_name = character(),
  ...,
  instance_label = NULL
)

Arguments

bag_label

A character, factor, or numeric vector.

bag_name

A character or factor vector.

instance_name

A character or factor vector.

...

A set of name-value pairs. These construct the covariates for a mild_df.

instance_label

A character, factor, or numeric vector, or NULL.

Details

We refer to the rows of a mild_df as samples, since they are thought of as draws from the distribution that determines each instance. Each instance is contained in a bag, with a corresponding label. Instance labels can be provided, but they will be pulled in as an attribute.

Value

A 'mild_df' object. This data.frame-like has columns bag_label, bag_name, instance_name, and those specified in .... It also inherits from the 'tbl_df' and 'tbl' classes.

Author(s)

Yifei Liu, Sean Kent

See Also

  • as_mild_df() to convert data.frames to mild_dfs.

  • generate_mild_df() for simulating a mild_df object.

  • summarize_samples() for summarizing the mild_df into a multiple instance learning data set.

Examples

mild_df('bag_label' = factor(c(1, 1, 0)),
        'bag_name' = c(rep('bag_1', 2), 'bag_2'),
        'instance_name' = c('bag_1_inst_1', 'bag_1_inst_2', 'bag_2_inst_1'),
        'X1' = c(-0.4, 0.5, 2),
        'instance_label' = c(0, 1, 0))


mildsvm documentation built on July 14, 2022, 9:08 a.m.