predict.cv_misvm | R Documentation |
cv_misvm
objectPredict method for cv_misvm
object
## S3 method for class 'cv_misvm' predict( object, new_data, type = c("class", "raw"), layer = c("bag", "instance"), new_bags = "bag_name", ... )
object |
An object of class |
new_data |
A data frame to predict from. This needs to have all of the features that the data was originally fitted with. |
type |
If |
layer |
If |
new_bags |
A character or character vector. Can specify a singular
character that provides the column name for the bag names in |
... |
Arguments passed to or from other methods. |
A tibble with nrow(new_data)
rows. If type = 'class'
, the tibble
will have a column '.pred_class'. If type = 'raw'
, the tibble will have
a column '.pred'.
Sean Kent
mil_data <- generate_mild_df( nbag = 10, nsample = 20, positive_degree = 3 ) df1 <- build_instance_feature(mil_data, seq(0.05, 0.95, length.out = 10)) mdl1 <- cv_misvm(x = df1[, 4:123], y = df1$bag_label, bags = df1$bag_name, cost_seq = 2^(-2:2), n_fold = 3, method = "heuristic") predict(mdl1, new_data = df1, type = "raw", layer = "bag") # summarize predictions at the bag layer suppressWarnings(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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.