Learn R Programming

easyalluvial (version 0.2.2)

tidy_imp: tidy up dataframe containing model feature importance

Description

returns dataframe with exactly two columns, vars and imp and aggregates dummy encoded variables. Helper function called by all functions that take an imp parameter. Can be called manually if formula for aggregating dummy encoded variables must be modified.

Usage

tidy_imp(imp, df, .f = max)

Arguments

imp

dataframe or matrix with feature importance information

df

dataframe, modelling training data

.f

window function, Default: max

Value

dataframe

vars

character column with feature names

imp

numerical column, importance values

Examples

Run this code
# NOT RUN {
# randomforest
df = mtcars2[, ! names(mtcars2) %in% 'ids' ]
m = randomForest::randomForest( disp ~ ., df)
imp = m$importance
tidy_imp(imp, mtcars2)

# }

Run the code above in your browser using DataLab