parcats requires an alluvial plot created with easyalluvial to create an interactive parrallel categories diagram.


Parcats from alluvial from data in wide format

p <- alluvial_wide(mtcars2, max_variables = 5)
## Warning: There was 1 warning in `mutate()`.
##  In argument: `mpg = (function (f, na_level = "(Missing)") ...`.
## Caused by warning:
## ! `fct_explicit_na()` was deprecated in forcats 1.0.0.
##  Please use `fct_na_value_to_level()` instead.
##  The deprecated feature was likely used in the easyalluvial package.
##   Please report the issue to the authors.
parcats(p, marginal_histograms = TRUE, data_input = mtcars2)

Parcats from model response alluvial

Machine Learning models operate in a multidimensional space and their response is hard to visualise. Model response and partial dependency plots attempt to visualise ML models in a two dimensional space. Using alluvial plots or parrallel categories diagrams we can increase the number of dimensions.

Here we see the response of a random forest model if we vary the three variables with the highest importance while keeping all other features at their median/mode value.

df <- select(mtcars2, -ids )
m <- randomForest::randomForest( disp ~ ., df)
imp <- m$importance
dspace <- get_data_space(df, imp, degree = 3)
pred <- predict(m, newdata = dspace)
p <- alluvial_model_response(pred, dspace, imp, degree = 3)

parcats(p, marginal_histograms = TRUE, imp = TRUE, data_input = df)