Skip to content

Commit 866e961

Browse files
committed
apply mlr-style
1 parent c4b9a26 commit 866e961

File tree

6 files changed

+10
-11
lines changed

6 files changed

+10
-11
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ Suggests:
3939
care,
4040
FSelectorRcpp,
4141
lgr,
42-
mlr3measures,
4342
mlr3learners,
43+
mlr3measures,
4444
praznik,
4545
rpart,
4646
testthat
4747
Encoding: UTF-8
4848
NeedsCompilation: no
4949
Roxygen: list(markdown = TRUE, r6 = FALSE)
50-
RoxygenNote: 7.0.1
50+
RoxygenNote: 7.0.2
5151
Collate:
5252
'Filter.R'
5353
'mlr_filters.R'

R/Filter.R

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ Filter = R6Class("Filter",
8080

8181
initialize = function(id, task_type, task_properties = character(), param_set = ParamSet$new(),
8282
feature_types = character(), packages = character()) {
83-
8483
self$id = assert_string(id)
8584
self$task_type = assert_subset(task_type, mlr_reflections$task_types$type, empty.ok = FALSE)
8685
self$task_properties = assert_subset(task_properties, unlist(mlr_reflections$task_properties, use.names = FALSE))
@@ -106,7 +105,6 @@ Filter = R6Class("Filter",
106105
},
107106

108107
calculate = function(task, nfeat = NULL) {
109-
110108
task = assert_task(as_task(task), feature_types = self$feature_types, task_properties = self$task_properties)
111109
fn = task$feature_names
112110

R/FilterAUC.R

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,12 @@ FilterAUC = R6Class("FilterAUC", inherit = Filter,
5454
mlr_filters$add("auc", FilterAUC)
5555

5656

57-
auc = function (truth, prob) {
57+
auc = function(truth, prob) {
5858
n_pos = sum(truth)
5959
n_neg = length(truth) - n_pos
60-
if (n_pos == 0L || n_neg == 0L)
60+
if (n_pos == 0L || n_neg == 0L) {
6161
return(0.5)
62+
}
6263
r = rank(prob, ties.method = "average")
63-
(sum(r[truth]) - n_pos * (n_pos + 1L)/2L)/(n_pos * n_neg)
64+
(sum(r[truth]) - n_pos * (n_pos + 1L) / 2L) / (n_pos * n_neg)
6465
}

R/FilterInformationGain.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#' filterGR$param_set$values = list("type" = "gainratio")
3939
#' filterGR$calculate(task)
4040
#' head(as.data.table(filterGR), 3)
41-
#'
4241
FilterInformationGain = R6Class("FilterInformationGain", inherit = Filter,
4342
public = list(
4443
initialize = function() {

man/FilterInformationGain.Rd

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test_filter_regr.R

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ test_that("all regr filters return correct filter values", {
1515
test_that("Errors for unsupported features", {
1616
# list filters that only support "numeric" features
1717
filters = mlr_filters$mget(mlr_filters$keys())
18-
filters = Filter(function(x) all(grepl(paste(c("numeric", "integer"),
19-
collapse = "|"), x$feature_types)), filters)
18+
filters = Filter(function(x) {
19+
all(grepl(paste(c("numeric", "integer"),
20+
collapse = "|"), x$feature_types))
21+
}, filters)
2022
filters = filters[lengths(filters) != 0]
2123

2224
# supported: numeric, integer

0 commit comments

Comments
 (0)