# NOT RUN {
# Attach cvms
library(cvms)
# Create a tibble with 5 classes and 10 observations
# Apply softmax to make sure the probabilities sum to 1
multiclass_probability_tibble(num_classes = 5,
num_observations = 10,
apply_softmax = TRUE)
# Using the rnorm function to generate the random numbers
multiclass_probability_tibble(num_classes = 5,
num_observations = 10,
apply_softmax = TRUE,
FUN = rnorm)
# Creating a custom generator function that
# exponentiates the numbers to create more "certain" predictions
rcertain <- function(n){
(runif(n, min = 1, max = 100)^1.4)/100
}
multiclass_probability_tibble(num_classes = 5,
num_observations = 10,
apply_softmax = TRUE,
FUN = rcertain)
# }
Run the code above in your browser using DataLab