calculate_quantiles: Calculate Quantiles of Feature Importance

View source: R/calculatePvalues.R

calculate_quantilesR Documentation

Calculate Quantiles of Feature Importance

Description

This function computes the mean, lower, and upper quantiles of permuted feature importance scores and compares them with the observed importance scores from the true values. It is used to assess the significance of feature importances from random forest models by comparing them against a distribution of importances obtained through permutation.

Usage

calculate_quantiles(truevalues, permutedvalues, alpha = 0.05)

Arguments

truevalues

A data frame containing true feature importance data. It should have columns: feature_rank, feature_importance, and log_feature_importance. This is typically obtained from the calculate_feature_importances function. (It is feat_importances$true_importances).

permutedvalues

A data frame containing permuted feature importance data. It should have the same structure as truevalues and is typically obtained from the calculate_feature_importances function. (It is feat_importances$permuted_importances).

alpha

Numeric value representing the significance level used to calculate the upper and lower quantiles of the permuted importances. It must be between 0 and 1, exclusive. Default is 0.05.

Value

A tibble/data frame with columns for feature rank, mean permuted importance, lower and upper quantile bounds, observed true importance, and their respective logarithmic transformations. This data frame provides a comprehensive view of where true importances lie in relation to the distribution of permuted importances.

Examples

quantile_results <- calculate_quantiles(feat_importances$true_importances, feat_importances$permuted_importances, alpha=0.05)


tkolisnik/Rf2pval documentation built on Feb. 20, 2024, 5:39 a.m.