View source: R/extracting_distribution.R
| feat_reorder | R Documentation |
feat_dist rows to match preprocessed dataEnsures row order in feat_dist matches the column prefix order in the
preprocessed (dummy-coded) training data. This assumes dummy columns are
named as <original_name>_<level> and therefore start with the original
variable name.
feat_reorder(feat_dist, data)
feat_dist |
Data frame from |
data |
Data frame of the original (preprocessed) variables. |
The input feat_dist, reordered to align with data.
extracting_distribution(), set_feat_dist()
# Small toy dataset
data_example <- data.frame(
cont = rnorm(5),
bin = c(0, 1, 0, 1, 1),
cat = factor(c("A", "B", "C", "A", "C"))
)
# Extract feature distributions in original column order
feat_dist <- extracting_distribution(data_example)
# Suppose preprocessing (e.g., dummy coding) reordered the columns
data_reordered <- data_example[, c("cat", "cont", "bin")]
# Reorder feat_dist rows to match the preprocessed data columns
feat_dist_reordered <- feat_reorder(feat_dist, data_reordered)
feat_dist_reordered
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.