mil_data <- generate_mild_df(nbag = 20,
positive_prob = 0.15,
sd_of_mean = rep(0.1, 3))
df1 <- build_instance_feature(mil_data, seq(0.05, 0.95, length.out = 10))
mdl1 <- misvm(x = df1[, 4:63], y = df1$bag_label,
bags = df1$bag_name, method = "heuristic")
predict(mdl1, new_data = df1, type = "raw", layer = "bag")
# summarize predictions at the bag layer
library(dplyr)
df1 %>%
bind_cols(predict(mdl1, df1, type = "class")) %>%
bind_cols(predict(mdl1, df1, type = "raw")) %>%
distinct(bag_name, bag_label, .pred_class, .pred)
Run the code above in your browser using DataLab