Closed michaellevy closed 6 years ago
Hey @taylorlarsen -- Didn't you do some planning on how limone-output tables should be shaped a few months back? Would you rather always have the same columns, or always have one row for each input row?
I have it in tidy format now (always the same columns, multiple rows for each observation). Would you prefer it like this or the way Yannick had it before? Any changes you'd like to see in the output format?
library(healthcareai)
m <- machine_learn(pima_diabetes, patient_id, outcome = diabetes, tune = FALSE, models = "xgb")
healthcareai:::pip(
model = m,
d = pima_diabetes[1:3, ],
new_values = list(weight_class = c("underweight", "normal", "overweight"),
plasma_glucose = c(75, 100))) %>%
tibble::glimpse()
#> Observations: 9
#> Variables: 7
#> $ patient_id <int> 1, 1, 1, 2, 2, 2, 3, 3, 3
#> $ modifiable_variable <chr> "plasma_glucose", "weight_class", "plasma_...
#> $ original_value <chr> "148", "obese", "148", "overweight", "85",...
#> $ modified_value <chr> "75", "normal", "100", "normal", "75", "ov...
#> $ original_prediction <dbl> 0.9095685, 0.9095685, 0.9095685, 0.1431171...
#> $ modified_prediction <dbl> 0.11648774, 0.27009362, 0.32216263, 0.0518...
#> $ improvement <dbl> 0.793080710, 0.639474832, 0.587405823, 0.0...
Created on 2018-07-19 by the reprex package (v0.2.0).
should be called after/separately from
predict
rather than being a switch to turn on during predict