if (require(gurobi)) {
data("ordmvnorm")
x <- ordmvnorm[, 3:7]
y <- ordmvnorm$bag_label
bags <- ordmvnorm$bag_name
mdl1 <- omisvm(x, y, bags, weights = NULL)
# summarize predictions at the bag layer
library(dplyr)
df1 <- bind_cols(y = y, bags = bags, as.data.frame(x))
df1 %>%
bind_cols(predict(mdl1, df1, new_bags = bags, type = "class")) %>%
bind_cols(predict(mdl1, df1, new_bags = bags, type = "raw")) %>%
distinct(y, bags, .pred_class, .pred)
}
Run the code above in your browser using DataLab