Skip to content

Commit 24d4694

Browse files
pat-smllg
authored andcommitted
Tidy pkg, prepare for release (#54)
1 parent 542bfbc commit 24d4694

40 files changed

+178
-191
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
^\.ignore$
1212
^docs$
1313
^pkgdown$
14+
.pre-commit-config.yaml

.github/CONTRIBUTING.md

Lines changed: 0 additions & 41 deletions
This file was deleted.

.github/ISSUE_TEMPLATE.md

Lines changed: 0 additions & 11 deletions
This file was deleted.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# History files
33
.Rhistory
44
.Rapp.history
5-
65
# Session Data files
76
.RData
87
# Example code in package build process
@@ -26,3 +25,4 @@ vignettes/*.pdf
2625
*.knit.md
2726
# Shiny token, see https://shiny.rstudio.com/articles/shinyapps.html
2827
rsconnect/
28+
.pre-commit-config.yaml

DESCRIPTION

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ Authors@R:
1717
role = "aut",
1818
email = "bernd_bischl@gmx.net",
1919
comment = c(ORCID = "0000-0001-6002-6980")))
20-
Description: Implements methods for feature selection via
21-
filtering in 'mlr3'.
20+
Description: Extends mlr3 with filter methods for feature
21+
selection. Besides standalone filter methods (for example MRMR, CMIM)
22+
built-in methods of any machine-learning algorithm are supported.
23+
Partial scoring of multivariate filter methods is supported.
2224
License: LGPL-3
2325
URL: https://mlr3filters.mlr-org.com, https://github.com/mlr-org/mlr3filters
2426
BugReports: https://github.com/mlr-org/mlr3filters/issues

R/FilterAUC.R

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,17 @@
44
#' @format [R6::R6Class] inheriting from [Filter].
55
#' @include Filter.R
66
#'
7-
#' @description
8-
#' Area under the (ROC) Curve filter calling [Metrics::auc()] from package \CRANpkg{Metrics}.
9-
#' Returns the absolute value of the difference between the AUC and 0.5.
7+
#' @description Area under the (ROC) Curve filter calling [Metrics::auc()] from
8+
#' package \CRANpkg{Metrics}. Returns the absolute value of the difference
9+
#' between the AUC and 0.5.
1010
#'
1111
#' @family Filter
1212
#' @export
1313
#' @examples
1414
#' task = mlr3::mlr_tasks$get("pima")
1515
#' filter = FilterAUC$new()
1616
#' filter$calculate(task)
17-
#' head(filter$scores, 3)
18-
#' as.data.table(filter)
17+
#' head(as.data.table(filter), 3)
1918
FilterAUC = R6Class("FilterAUC", inherit = Filter,
2019
public = list(
2120
initialize = function(id = "auc") {

R/FilterAnova.R

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,19 @@
44
#' @format [R6::R6Class] inheriting from [Filter].
55
#' @include Filter.R
66
#'
7-
#' @description
8-
#' ANOVA F-Test filter calling [stats::aov()].
9-
#' Note that this is equivalent to a t-test for binary classification.
7+
#' @description ANOVA F-Test filter calling [stats::aov()]. Note that this is
8+
#' equivalent to a t-test for binary classification.
109
#'
11-
#' The filter value is `-log10(p)` where `p` is the p-value.
12-
#' This transformation is necessary to ensure numerical stability for very small p-values.
10+
#' The filter value is `-log10(p)` where `p` is the p-value. This transformation
11+
#' is necessary to ensure numerical stability for very small p-values.
1312
#'
1413
#' @family Filter
1514
#' @export
1615
#' @examples
1716
#' task = mlr3::mlr_tasks$get("iris")
1817
#' filter = FilterAnova$new()
1918
#' filter$calculate(task)
20-
#' as.data.table(filter)
19+
#' head(as.data.table(filter), 3)
2120
#'
2221
#' # transform to p-value
2322
#' 10^(-filter$scores)

R/FilterCMIM.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#' @format [R6::R6Class] inheriting from [Filter].
55
#' @include Filter.R
66
#'
7-
#' @description
8-
#' Minimal conditional mutual information maximisation filter calling [praznik::CMIM()] from package \CRANpkg{praznik}.
7+
#' @description Minimal conditional mutual information maximisation filter
8+
#' calling [praznik::CMIM()] from package \CRANpkg{praznik}.
99
#'
1010
#' This filter supports partial scoring (see [Filter]).
1111
#'
@@ -15,8 +15,6 @@
1515
#' task = mlr3::mlr_tasks$get("iris")
1616
#' filter = FilterCMIM$new()
1717
#' filter$calculate(task, nfeat = 2)
18-
#'
19-
#' head(filter$scores, 2)
2018
#' as.data.table(filter)
2119
FilterCMIM = R6Class("FilterCMIM", inherit = Filter,
2220
public = list(

R/FilterCarScore.R

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
#' @format [R6::R6Class] inheriting from [Filter].
55
#' @include Filter.R
66
#'
7-
#' @description
8-
#' Calculates the Correlation-Adjusted (marginal) coRelation scores (short CAR scores)
9-
#' implemented in [care::carscore()] in package \CRANpkg{care}.
10-
#' The CAR scores for a set of features are defined as the correlations between the target
11-
#' and the decorrelated features. The filter returns the absolute value of the calculated scores.
7+
#' @description Calculates the Correlation-Adjusted (marginal) coRelation scores
8+
#' (short CAR scores) implemented in [care::carscore()] in package
9+
#' \CRANpkg{care}. The CAR scores for a set of features are defined as the
10+
#' correlations between the target and the decorrelated features. The filter
11+
#' returns the absolute value of the calculated scores.
1212
#'
1313
#' Argument `verbose` defaults to `FALSE`.
1414
#'
@@ -18,8 +18,13 @@
1818
#' task = mlr3::mlr_tasks$get("mtcars")
1919
#' filter = FilterCarScore$new()
2020
#' filter$calculate(task)
21-
#' head(filter$scores, 3)
22-
#' as.data.table(filter)
21+
#' head(as.data.table(filter), 3)
22+
#'
23+
#' ## changing filter settings
24+
#' filter = FilterCarScore$new()
25+
#' filter$param_set$values = list("diagonal" = TRUE)
26+
#' filter$calculate(task)
27+
#' head(as.data.table(filter), 3)
2328
FilterCarScore = R6Class("FilterCarScore", inherit = Filter,
2429
public = list(
2530
initialize = function(id = "carscore") {
@@ -31,9 +36,9 @@ FilterCarScore = R6Class("FilterCarScore", inherit = Filter,
3136
param_set = ParamSet$new(list(
3237
ParamDbl$new("lambda", lower = 0, upper = 1, default = NO_DEF),
3338
ParamLgl$new("diagonal", default = FALSE),
34-
ParamLgl$new("verbose", default = TRUE))),
35-
param_vals = list(verbose = FALSE)
39+
ParamLgl$new("verbose", default = TRUE)))
3640
)
41+
self$param_set$values = list(verbose = FALSE)
3742
},
3843

3944
calculate_internal = function(task, nfeat) {

R/FilterCorrelation.R

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,17 @@
1111
#' @family Filter
1212
#' @export
1313
#' @examples
14+
#' ## Pearson (default)
1415
#' task = mlr3::mlr_tasks$get("mtcars")
1516
#' filter = FilterCorrelation$new()
1617
#' filter$calculate(task)
1718
#' as.data.table(filter)
19+
#'
20+
#' ## Spearman
21+
#' filter = FilterCorrelation$new()
22+
#' filter$param_set$values = list("method" = "spearman")
23+
#' filter$calculate(task)
24+
#' as.data.table(filter)
1825
FilterCorrelation = R6Class("FilterCorrelation", inherit = Filter,
1926
public = list(
2027
initialize = function(id = "correlation") {

0 commit comments

Comments
 (0)