Extracts variable importance scores from models fitted with rf(), rf_repeat(), or rf_spatial().
Arguments
- model
Model object from
rf(),rf_repeat(), orrf_spatial().
Value
Data frame with columns variable (character) and importance (numeric), sorted by decreasing importance.
Details
For spatial models (rf_spatial()) with many spatial predictors, this function returns aggregated importance statistics for spatial predictors to improve readability. Non-spatial models return per-variable importance scores directly.
See also
rf(), rf_repeat(), rf_spatial(), plot_importance(), print_importance()
Other model_info:
get_evaluation(),
get_importance_local(),
get_moran(),
get_performance(),
get_predictions(),
get_residuals(),
get_response_curves(),
get_spatial_predictors(),
print.rf(),
print_evaluation(),
print_importance(),
print_moran(),
print_performance()
Examples
data(plants_rf)
# Extract variable importance
importance <- get_importance(plants_rf)
head(importance)
#> variable importance
#> 1 climate_bio1_average 1949.457
#> 2 human_population 1595.806
#> 3 climate_hypervolume 1188.702
#> 4 bias_area_km2 1177.989
#> 5 human_population_density 1026.905
#> 6 human_footprint_average 1021.417
# View top 5 most important variables
importance[1:5, ]
#> variable importance
#> 1 climate_bio1_average 1949.457
#> 2 human_population 1595.806
#> 3 climate_hypervolume 1188.702
#> 4 bias_area_km2 1177.989
#> 5 human_population_density 1026.905