The text in multiclass plots tends to overwrite itself when the number of classes gets large. I'd like to give the user the option to:
remove the text from the plot or print it with a smaller text size.
rotate (x axis only) and truncate the labels to 10 characters or so.
library(tidyverse)
library(healthcareai)
#> healthcareai version 2.2.0
#> Please visit https://docs.healthcare.ai for full documentation and vignettes. Join the community at https://healthcare-ai.slack.com
d <- nycflights13::flights
top_40 <- d %>%
count(dest) %>%
arrange(desc(n)) %>%
slice(1:40) %>%
pull(dest)
d2 <- d %>%
filter(dest %in% top_40) %>%
slice(1:10000)
m <- machine_learn(d2, outcome = dest, models = "rf", tune = FALSE, n_folds = 4)
#> Training new data prep recipe...
#> Removing the following 2 near-zero variance column(s). If you don't want to remove them, call prep_data with remove_near_zero_variance as a smaller numeric or FALSE.
#> year and month
#>
#> dest looks multiclass, so training multiclass algorithms.
#>
#> After data processing, models are being trained on 35 features with 10,000 observations.
#> Based on n_folds = 4 and hyperparameter settings, the following number of models will be trained: 4 rf's
#> Training at fixed values: Random Forest
#>
#> *** Models successfully trained. The model object contains the training data minus ignored ID columns. ***
#> *** If there was PHI in training data, normal PHI protocols apply to the model object. ***
p <- predict(m)
plot(p)
The text in multiclass plots tends to overwrite itself when the number of classes gets large. I'd like to give the user the option to: