HealthCatalyst / healthcareai-r

R tools for healthcare machine learning
https://docs.healthcare.ai
Other
245 stars 106 forks source link

Multiclass plot method text #1263

Closed mmastand closed 6 years ago

mmastand commented 6 years ago

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:

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)

image.png