Wraps alluvial_model_response
and
get_data_space
into one call for caret models.
alluvial_model_response_caret(
train,
degree = 4,
bins = 5,
bin_labels = c("LL", "ML", "M", "MH", "HH"),
col_vector_flow = c("#FF0065", "#009850", "#A56F2B", "#005EAA", "#710500", "#7B5380",
"#9DD1D1"),
method = "median",
params_bin_numeric_pred = list(center = T, transform = T, scale = T),
pred_train = NULL,
stratum_label_size = 3.5,
force = F,
...
)
caret train object
integer, number of top important variables to select. For plotting more than 4 will result in two many flows and the alluvial plot will not be very readable, Default: 4
integer, number of bins for numeric variables, increasing this number might result in too many flows, Default: 5
labels for the bins from low to high, Default: c("LL", "ML", "M", "MH", "HH")
character vector, defines flow colours, Default: c('#FF0065','#009850', '#A56F2B', '#005EAA', '#710500')
character vector, one of c('median', 'pdp')
sets variables that are not displayed to median mode, use with regular predictions
partial dependency plot method, for each observation in the training data the displayed variableas are set to the indicated values. The predict function is called for each modified observation and the result is averaged
. Default: 'median'
list, additional parameters passed to
manip_bin_numerics
which is applied to the pred
parameter. Default: list( bins = 5, center = T, transform = T, scale = T)
numeric vector, base the automated binning of the pred vector on the distribution of the training predictions. This is useful if marginal histograms are added to the plot later. Default = NULL
numeric, Default: 3.5
logical, force plotting of over 1500 flows, Default: FALSE
additional parameters passed to
alluvial_wide
ggplot2 object
this model visualisation approach follows the "visualising the model in the dataspace" principle as described in Wickham H, Cook D, Hofmann H (2015) Visualizing statistical models: Removing the blindfold. Statistical Analysis and Data Mining 8(4) <doi:10.1002/sam.11271>
alluvial_wide
,
get_data_space
, varImp
,
extractPrediction
,
get_data_space
,
get_pdp_predictions
# NOT RUN {
df = mtcars2[, ! names(mtcars2) %in% 'ids' ]
train = caret::train( disp ~ .
, df
, method = 'rf'
, trControl = caret::trainControl( method = 'none' )
, importance = TRUE )
alluvial_model_response_caret(train, degree = 3)
# partial dependency plotting method
# }
# NOT RUN {
alluvial_model_response_caret(train, degree = 3, method = 'pdp')
# }
Run the code above in your browser using DataLab