Skip to content

Commit

Permalink
docs: update
Browse files Browse the repository at this point in the history
  • Loading branch information
be-marc committed Jun 11, 2024
1 parent bc12f35 commit 7ac4b6c
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 48 deletions.
39 changes: 20 additions & 19 deletions R/EnsembleFSResult.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,27 @@
#'
#' @examples
#' \donttest{
#' efsr = ensemble_fselect(
#' fselector = fs("rfe", n_features = 2, feature_fraction = 0.8),
#' task = tsk("sonar"),
#' learners = lrns(c("classif.rpart", "classif.featureless")),
#' init_resampling = rsmp("subsampling", repeats = 2),
#' inner_resampling = rsmp("cv", folds = 3),
#' measure = msr("classif.ce"),
#' terminator = trm("none")
#' )
#' efsr = ensemble_fselect(
#' fselector = fs("rfe", n_features = 2, feature_fraction = 0.8),
#' task = tsk("sonar"),
#' learners = lrns(c("classif.rpart", "classif.featureless")),
#' init_resampling = rsmp("subsampling", repeats = 2),
#' inner_resampling = rsmp("cv", folds = 3),
#' measure = msr("classif.ce"),
#' terminator = trm("none")
#' )
#'
#' # contains the benchmark result
#' efsr$benchmark_result
#' # contains the benchmark result
#' efsr$benchmark_result
#'
#' # contains the selected features for each iteration
#' efsr$result
#' # contains the selected features for each iteration
#' efsr$result
#'
#' # returns the stability of the selected features
#' efsr$stability(stability_measure = "jaccard")
#' # returns the stability of the selected features
#' efsr$stability(stability_measure = "jaccard")
#'
#' # returns a ranking of all features
#' head(efsr$feature_ranking())
#' # returns a ranking of all features
#' head(efsr$feature_ranking())
#' }
EnsembleFSResult = R6Class("EnsembleFSResult",
public = list(
Expand Down Expand Up @@ -149,6 +149,9 @@ EnsembleFSResult = R6Class("EnsembleFSResult",
#' Whether to calculate the stability globally or for each learner.
#' @param reset_cache (`logical(1)`)\cr
#' If `TRUE`, the cached results are ignored.
#'
#' @return A `numeric()` value representing the stability of the selected features.
#' Or a `numeric()` vector with the stability of the selected features for each learner.
stability = function(stability_measure = "jaccard", ..., global = TRUE, reset_cache = FALSE) {
funs = stabm::listStabilityMeasures()$Name
keys = tolower(gsub("stability", "", funs))
Expand All @@ -175,8 +178,6 @@ EnsembleFSResult = R6Class("EnsembleFSResult",
private$.stability_learner[[stability_measure]] = set_names(tab$score, tab$learner_id)
private$.stability_learner[[stability_measure]]
}


}
),

Expand Down
4 changes: 3 additions & 1 deletion R/ensemble_fselect.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#' @description
#' Ensemble feature selection using multiple learners.
#' The ensemble feature selection method is designed to identify the most informative features from a given dataset by leveraging multiple machine learning models and resampling techniques.
#' Returns an [EnsembleFSResult].
#'
#' @details
#' The method begins by applying an initial resampling technique specified by the user, to create **multiple subsamples** from the original dataset.
Expand Down Expand Up @@ -42,7 +43,7 @@
#' @export
#' @examples
#' \donttest{
#' ensemble_fselect(
#' efsr = ensemble_fselect(
#' fselector = fs("random_search"),
#' task = tsk("sonar"),
#' learners = lrns(c("classif.rpart", "classif.featureless")),
Expand All @@ -51,6 +52,7 @@
#' measure = msr("classif.ce"),
#' terminator = trm("evals", n_evals = 10)
#' )
#' efsr
#' }
ensemble_fselect = function(
fselector,
Expand Down
56 changes: 29 additions & 27 deletions man/ensemble_fs_result.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion man/ensemble_fselect.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 7ac4b6c

Please sign in to comment.