orsf_vi {aorsf} | R Documentation |
Estimate the importance of individual variables using oblique random survival forests.
orsf_vi(object, group_factors = TRUE, importance = NULL, oobag_fun = NULL, ...)
orsf_vi_negate(object, group_factors = TRUE, oobag_fun = NULL, ...)
orsf_vi_permute(object, group_factors = TRUE, oobag_fun = NULL, ...)
orsf_vi_anova(object, group_factors = TRUE, ...)
object |
(orsf_fit) a trained oblique random survival forest (see orsf). |
group_factors |
(logical) if |
importance |
(character) Indicate method for variable importance:
|
oobag_fun |
(function) to be used for evaluating out-of-bag prediction accuracy after negating coefficients (if importance = 'negate') or permuting the values of a predictor (if importance = 'permute')
For more details, see the out-of-bag vignette. |
... |
Further arguments passed to or from other methods (not currently used). |
When an orsf_fit
object is fitted with importance = 'anova', 'negate', or
'permute', the output will have a vector of importance values based on
the requested type of importance. However, you may still want to call
orsf_vi()
on this output if you want to group factor levels into one
overall importance value.
orsf_vi()
is a general purpose function to extract or compute variable
importance estimates from an 'orsf_fit'
object (see orsf).
orsf_vi_negate()
, orsf_vi_permute()
, and orsf_vi_anova()
are wrappers
for orsf_vi()
. The way these functions work depends on whether the
object
they are given already has variable importance estimates in it
or not (see examples).
orsf_vi
functions return a named numeric vector.
Names of the vector are the predictor variables used by object
Values of the vector are the estimated importance of the given predictor.
The returned vector is sorted from highest to lowest value, with higher values indicating higher importance.
negation importance: Each variable is assessed separately by multiplying the variable's coefficients by -1 and then determining how much the model's performance changes. The worse the model's performance after negating coefficients for a given variable, the more important the variable. This technique is promising b/c it does not require permutation and it emphasizes variables with larger coefficients in linear combinations, but it is also relatively new and hasn't been studied as much as permutation importance. See Jaeger, 2022 for more details on this technique.
permutation importance: Each variable is assessed separately by randomly permuting the variable's values and then determining how much the model's performance changes. The worse the model's performance after permuting the values of a given variable, the more important the variable. This technique is flexible, intuitive, and frequently used. It also has several known limitations
analysis of variance (ANOVA) importance: A p-value is computed for each coefficient in each linear combination of variables in each decision tree. Importance for an individual predictor variable is the proportion of times a p-value for its coefficient is < 0.01. This technique is very efficient computationally, but may not be as effective as permutation or negation in terms of selecting signal over noise variables. See Menze, 2011 for more details on this technique.
The default variable importance technique, ANOVA, is calculated while you fit an ORSF ensemble.
fit <- orsf(pbc_orsf, Surv(time, status) ~ . - id) fit
## ---------- Oblique random survival forest ## ## Linear combinations: Accelerated ## N observations: 276 ## N events: 111 ## N trees: 500 ## N predictors total: 17 ## N predictors per node: 5 ## Average leaves per tree: 25 ## Min observations in leaf: 5 ## Min events in leaf: 1 ## OOB stat value: 0.84 ## OOB stat type: Harrell's C-statistic ## Variable importance: anova ## ## -----------------------------------------
ANOVA is the default because it is fast, but it may not be as decisive as the permutation and negation techniques for variable selection.
the ‘raw’ variable importance values can be accessed from the fit object
attr(fit, 'importance_values')
## edema_1 ascites_1 bili copper age albumin ## 0.41468531 0.34547820 0.27357335 0.19702602 0.17831563 0.17231851 ## edema_0.5 protime chol stage sex_f spiders_1 ## 0.16100917 0.15265823 0.14529486 0.13818084 0.13186813 0.12881052 ## ast hepato_1 alk.phos trig platelet trt_placebo ## 0.12509496 0.11370348 0.10024752 0.09878683 0.08006941 0.06398488
these are ‘raw’ because values for factors have not been aggregated into a single value. Currently there is one value for k-1 levels of a k level factor. For example, you can see edema_1 and edema_0.5 in the importance values above because edema is a factor variable with levels of 0, 0.5, and 1.
To get aggregated values across all levels of each factor,
access the importance
element from the orsf
fit:
fit$importance
## ascites bili edema copper age albumin protime ## 0.34547820 0.27357335 0.26368761 0.19702602 0.17831563 0.17231851 0.15265823 ## chol stage sex spiders ast hepato alk.phos ## 0.14529486 0.13818084 0.13186813 0.12881052 0.12509496 0.11370348 0.10024752 ## trig platelet trt ## 0.09878683 0.08006941 0.06398488
use orsf_vi()
with group_factors set to TRUE
(the default)
orsf_vi(fit)
## ascites bili edema copper age albumin protime ## 0.34547820 0.27357335 0.26368761 0.19702602 0.17831563 0.17231851 0.15265823 ## chol stage sex spiders ast hepato alk.phos ## 0.14529486 0.13818084 0.13186813 0.12881052 0.12509496 0.11370348 0.10024752 ## trig platelet trt ## 0.09878683 0.08006941 0.06398488
Note that you can make the default returned importance values ungrouped
by setting group_factors
to FALSE
in the orsf_vi
functions or the
orsf
function.
You can fit an ORSF without VI, then add VI later
fit_no_vi <- orsf(pbc_orsf, Surv(time, status) ~ . - id, importance = 'none') # Note: you can't call orsf_vi_anova() on fit_no_vi because anova # VI can only be computed while the forest is being grown. orsf_vi_negate(fit_no_vi)
## bili copper age protime albumin ## 0.0717336945 0.0288601792 0.0253698687 0.0110960617 0.0100020838 ## chol ascites spiders ast stage ## 0.0075015628 0.0060950198 0.0045321942 0.0044280058 0.0025526151 ## edema sex hepato platelet alk.phos ## 0.0024856369 0.0015628256 0.0004688477 0.0003646593 -0.0007293186 ## trig trt ## -0.0020316733 -0.0061471140
orsf_vi_permute(fit_no_vi)
## age bili copper albumin chol ## 1.109606e-02 1.083559e-02 7.032715e-03 5.157324e-03 4.636383e-03 ## protime ascites spiders ast platelet ## 4.011252e-03 3.854970e-03 2.396333e-03 1.146072e-03 5.209419e-04 ## alk.phos edema sex hepato trig ## 2.083767e-04 1.959734e-04 5.209419e-05 -4.688477e-04 -1.719108e-03 ## trt ## -3.698687e-03
fit an ORSF and compute vi at the same time
fit_permute_vi <- orsf(pbc_orsf, Surv(time, status) ~ . - id, importance = 'permute') # get the vi instantly (i.e., it doesn't need to be computed again) orsf_vi_permute(fit_permute_vi)
## bili age copper stage ascites ## 0.0114086268 0.0094811419 0.0055219837 0.0043238175 0.0032298395 ## albumin hepato protime ast edema ## 0.0031256512 0.0030214628 0.0029172744 0.0021358616 0.0019051588 ## spiders chol alk.phos platelet trt ## 0.0017712023 0.0013023547 0.0008335070 -0.0009376954 -0.0016149198 ## sex trig ## -0.0020837675 -0.0022921442
You can still get negation VI from this fit, but it needs to be computed
orsf_vi_negate(fit_permute_vi)
## bili copper age protime albumin ## 0.0773598666 0.0272452594 0.0258387164 0.0115649094 0.0084392582 ## sex chol ast ascites stage ## 0.0081787872 0.0074494686 0.0060429256 0.0058866431 0.0043238175 ## hepato edema spiders platelet trig ## 0.0040112523 0.0027684339 0.0026047093 0.0005730360 0.0002083767 ## trt alk.phos ## -0.0003125651 -0.0016149198
Harrell FE, Califf RM, Pryor DB, Lee KL, Rosati RA. Evaluating the Yield of Medical Tests. JAMA 1982; 247(18):2543-2546. DOI: 10.1001/jama.1982.03320430047030
Breiman L. Random forests. Machine learning 2001 Oct; 45(1):5-32. DOI: 10.1023/A:1010933404324
Menze BH, Kelm BM, Splitthoff DN, Koethe U, Hamprecht FA. On oblique random forests. Joint European Conference on Machine Learning and Knowledge Discovery in Databases 2011 Sep 4; pp. 453-469. DOI: 10.1007/978-3-642-23783-6_29
Jaeger BC, Welden S, Lenoir K, Speiser JL, Segar MW, Pandey A, Pajewski NM. Accelerated and interpretable oblique random survival forests. arXiv e-prints 2022 Aug; arXiv-2208. URL: https://arxiv.org/abs/2208.01129