eval_feature_selection_err_funs | R Documentation |
Evaluate various feature selection metrics, given the true
feature support and the estimated feature support.
eval_feature_selection_err()
evaluates the various feature selection
metrics for each experimental replicate separately.
summarize_feature_selection_err()
summarizes the various feature
selection metrics across experimental replicates.
eval_feature_selection_err(
fit_results,
vary_params = NULL,
nested_cols = NULL,
truth_col,
estimate_col = NULL,
imp_col,
group_cols = NULL,
metrics = NULL,
na_rm = FALSE
)
summarize_feature_selection_err(
fit_results,
vary_params = NULL,
nested_cols = NULL,
truth_col,
estimate_col = NULL,
imp_col,
group_cols = NULL,
metrics = NULL,
na_rm = FALSE,
summary_funs = c("mean", "median", "min", "max", "sd", "raw"),
custom_summary_funs = NULL,
eval_id = "feature_selection"
)
fit_results |
A tibble, as returned by |
vary_params |
A vector of |
nested_cols |
(Optional) A character string or vector specifying the
name of the column(s) in |
truth_col |
A character string identifying the column in
|
estimate_col |
An (optional) character string identifying the column in
|
imp_col |
A character string identifying the column in
|
group_cols |
(Optional) A character string or vector specifying the column(s) to group rows by before evaluating metrics. This is useful for assessing within-group metrics. |
metrics |
A |
na_rm |
A |
summary_funs |
Character vector specifying how to summarize evaluation metrics. Must choose from a built-in library of summary functions - elements of the vector must be one of "mean", "median", "min", "max", "sd", "raw". |
custom_summary_funs |
Named list of custom functions to summarize results. Names in the list should correspond to the name of the summary function. Values in the list should be a function that takes in one argument, that being the values of the evaluated metrics. |
eval_id |
Character string. ID to be used as a suffix when naming result
columns. Default |
The output of eval_feature_selection_err()
is a tibble
with the
following columns:
Replicate ID.
Name of DGP.
Name of Method.
Name of the evaluation metric.
Value of the evaluation metric.
as well as any columns specified by group_cols
and vary_params
.
The output of summarize_feature_selection_err()
is a grouped
tibble
containing both identifying information and the feature
selection results aggregated over experimental replicates. Specifically, the
identifier columns include .dgp_name
, .method_name
, any columns
specified by group_cols
and vary_params
, and .metric
.
In addition, there are results columns corresponding to the requested
statistics in summary_funs
and custom_summary_funs
. These
columns end in the suffix specified by eval_id
.
Other feature_selection_funs:
eval_feature_importance_funs
,
eval_feature_selection_curve_funs
,
plot_feature_importance()
,
plot_feature_selection_curve()
,
plot_feature_selection_err()
# generate example fit_results data for a feature selection problem
fit_results <- tibble::tibble(
.rep = rep(1:2, times = 2),
.dgp_name = c("DGP1", "DGP1", "DGP2", "DGP2"),
.method_name = c("Method"),
feature_info = lapply(
1:4,
FUN = function(i) {
tibble::tibble(
# feature names
feature = c("featureA", "featureB", "featureC"),
# true feature support
true_support = c(TRUE, FALSE, TRUE),
# estimated feature support
est_support = c(TRUE, FALSE, FALSE),
# estimated feature importance scores
est_importance = c(10, runif(2, min = -2, max = 2))
)
}
)
)
# evaluate feature selection (using all default metrics) for each replicate
eval_results <- eval_feature_selection_err(
fit_results,
nested_cols = "feature_info",
truth_col = "true_support",
estimate_col = "est_support",
imp_col = "est_importance"
)
# summarize feature selection error (using all default metric) across replicates
eval_results_summary <- summarize_feature_selection_err(
fit_results,
nested_cols = "feature_info",
truth_col = "true_support",
estimate_col = "est_support",
imp_col = "est_importance"
)
# evaluate/summarize feature selection errors using specific yardstick metrics
metrics <- yardstick::metric_set(yardstick::sens, yardstick::spec)
eval_results <- eval_feature_selection_err(
fit_results,
nested_cols = "feature_info",
truth_col = "true_support",
estimate_col = "est_support",
imp_col = "est_importance",
metrics = metrics
)
eval_results_summary <- summarize_feature_selection_err(
fit_results,
nested_cols = "feature_info",
truth_col = "true_support",
estimate_col = "est_support",
imp_col = "est_importance",
metrics = metrics
)
# summarize feature selection errors using specific summary metric
range_fun <- function(x) return(max(x) - min(x))
eval_results_summary <- summarize_feature_selection_err(
fit_results,
nested_cols = "feature_info",
truth_col = "true_support",
estimate_col = "est_support",
imp_col = "est_importance",
custom_summary_funs = list(range_feature_selection = range_fun)
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.