Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
sebffischer committed Feb 22, 2024
1 parent 544ae50 commit 4e285f9
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion R/GraphLearner.R
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ GraphLearner = R6Class("GraphLearner", inherit = Learner,
}
),
private = list(
.contingent_properties = function() {
.dependent_properties = function() {
if (some(self$graph$pipeops, function(p) "uses_test_task" %in% p$properties)) {
"uses_test_task"
} else {
Expand Down
8 changes: 4 additions & 4 deletions R/PipeOp.R
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,11 @@ PipeOp = R6Class("PipeOp",
if (!missing(rhs)) {
private$.properties = sort(assert_subset(rhs, mlr_reflections$pipeops$properties))
}
contingent_properties = private$.contingent_properties()
if (!length(contingent_properties)) {
dependent_properties = private$.dependent_properties()
if (!length(dependent_properties)) {
return(private$.properties)
}
sort(c(private$.properties, contingent_properties))
sort(c(private$.properties, dependent_properties))
},
id = function(val) {
if (!missing(val)) {
Expand Down Expand Up @@ -426,7 +426,7 @@ PipeOp = R6Class("PipeOp",
),

private = list(
.contingent_properties = function(rhs) {
.dependent_properties = function(rhs) {
character(0)
},
.properties = NULL,
Expand Down
2 changes: 1 addition & 1 deletion R/PipeOpLearner.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ PipeOpLearner = R6Class("PipeOpLearner", inherit = PipeOp,
),
private = list(
.learner = NULL,
.contingent_properties = function() {
.dependent_properties = function() {
if ("uses_test_task" %in% private$.learner$properties) {
"uses_test_task"
} else {
Expand Down
2 changes: 1 addition & 1 deletion R/PipeOpLearnerCV.R
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ PipeOpLearnerCV = R6Class("PipeOpLearnerCV",
}
),
private = list(
.contingent_properties = function() {
.dependent_properties = function() {
if ("uses_test_task" %in% private$.learner$properties) {
"uses_test_task"
} else {
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/helper_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ expect_datapreproc_pipeop_class = function(poclass, constargs = list(), task,
expect_true(n_use >= 4)
expect_true(task$nrow >= 5)
# overlay between use and test rows
tasktrain$partition(tasktrain$row_roles$use[seq(n_use - 2, n_use)], "test", remove = FALSE)
tasktrain$divide(tasktrain$row_roles$use[seq(n_use - 2, n_use)], "test", remove = FALSE)
tasktrain$row_roles$use = tasktrain$row_roles$use[seq(1, n_use - 2)]

taskpredict = tasktrain$clone(deep = TRUE)
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test_GraphLearner.R
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ test_that("GraphLearner hashes", {
test_that("early stopped xgboost learner works in graph", {
graph = po("pca") %>>% po("select", selector = selector_name("PC1")) %>>% lrn("classif.debug", uses_test_task = TRUE)
glrn = as_learner(graph)
task = tsk("iris")$partition(1:10, "test")
task = tsk("iris")$divide(1:10, "test")
glrn$train(task)
expect_true("PC1" %in% glrn$model$classif.debug$train_task$test_task$feature_names)
})
2 changes: 1 addition & 1 deletion tests/testthat/test_pipeop_impute.R
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ test_that("More tests for Integers", {
test_that("impute, test rows and affect_columns", {
po_impute = po("imputeconstant", affect_columns = selector_name("insulin"), constant = 2)
task = tsk("pima")
task$partition(1:30, "test")
task$divide(1:30, "test")
outtrain = po_impute$train(list(task))[[1L]]
outpredict = po_impute$predict(list(task$test_task))[[1L]]
expect_true(isTRUE(all.equal(outtrain$test_task$data(), outpredict$data())))
Expand Down

0 comments on commit 4e285f9

Please sign in to comment.