View source: R/gg_beta_uvarpro.R
| gg_beta_uvarpro | R Documentation |
Tidy wrapper around varPro::get.beta.entropy() for a uvarpro object.
Where gg_beta_varpro() refines the supervised release-rule contrast,
gg_beta_uvarpro() does the unsupervised analogue: uvarpro() builds
entropy regions with no response, and get.beta.entropy() fits a
cross-validated lasso within each region to ask how strongly every other
variable explains the released variable. Averaging the absolute lasso
coefficients per variable gives one number per variable: an unsupervised,
lasso-flavoured importance.
gg_beta_uvarpro(object, ..., cutoff = NULL, beta_fit = NULL)
object |
A |
... |
Forwarded to |
cutoff |
Selection threshold on |
beta_fit |
Optional pre-computed |
get.beta.entropy(o) returns a (released-variable x variable) numeric
matrix of absolute lasso coefficients. The column mean (na.rm = TRUE) is
the per-variable importance reported here, matching the canonical
sort(colMeans(beta, na.rm = TRUE), decreasing = TRUE) idiom in the
varPro::uvarpro() help ("iowa housing - illustrates lasso importance").
Because get.beta.entropy() is expensive (a cross-validated glmnet per
region), the beta_fit argument accepts a pre-computed matrix so you can
iterate on the cutoff without re-fitting. The pairing mirrors the
beta_fit argument of gg_beta_varpro().
A gg_beta_uvarpro object (a data.frame), one row per variable,
most-important first, with columns:
variablefactor; levels reversed so the most-important
variable lands at the top after coord_flip() (the gg_vimp
convention).
beta_meanmean(|lasso beta|) over the released regions
(colMeans(beta, na.rm = TRUE)).
n_releasednumber of regions contributing a non-NA
coefficient for the variable.
selectedlogical; beta_mean >= cutoff.
The provenance attribute records source, family ("unsupv"),
cutoff, n_var, n_released_regions, and precomputed.
gg_beta_varpro() (supervised analogue), gg_udependent(),
varPro::get.beta.entropy(), varPro::uvarpro().
if (requireNamespace("varPro", quietly = TRUE)) {
set.seed(1)
o <- varPro::uvarpro(mtcars, ntree = 50)
gg <- gg_beta_uvarpro(o)
plot(gg)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.