Skip to content

Commit

Permalink
maximize
Browse files Browse the repository at this point in the history
  • Loading branch information
ja-thomas committed Apr 25, 2018
1 parent 385f3cd commit b629639
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 8 deletions.
3 changes: 0 additions & 3 deletions R/RLearner_classif_xgboost.custom.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ makeRLearner.classif.xgboost.custom = function() {
cl = "classif.xgboost.custom",
package = "xgboost",
par.set = makeParamSet(
# we pass all of what goes in 'params' directly to ... of xgboost
# makeUntypedLearnerParam(id = "params", default = list()),
makeDiscreteLearnerParam(id = "booster", default = "gbtree", values = c("gbtree", "gblinear", "dart")),
makeUntypedLearnerParam(id = "watchlist", default = NULL, tunable = FALSE),
makeNumericLearnerParam(id = "eta", default = 0.3, lower = 0, upper = 1),
Expand All @@ -29,7 +27,6 @@ makeRLearner.classif.xgboost.custom = function() {
makeNumericLearnerParam(id = "tweedie_variance_power", lower = 1, upper = 2, default = 1.5, requires = quote(objective == "reg:tweedie")),
makeIntegerLearnerParam(id = "nthread", lower = 1L, tunable = FALSE),
makeIntegerLearnerParam(id = "nrounds", default = 1L, lower = 1L),
# FIXME nrounds seems to have no default in xgboost(), if it has 1, par.vals is redundant
makeUntypedLearnerParam(id = "feval", default = NULL, tunable = FALSE),
makeIntegerLearnerParam(id = "verbose", default = 1L, lower = 0L, upper = 2L, tunable = FALSE),
makeIntegerLearnerParam(id = "print_every_n", default = 1L, lower = 1L, tunable = FALSE,
Expand Down
1 change: 1 addition & 0 deletions R/RLearner_classif_xgboost.earlystop.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ makeRLearner.classif.xgboost.earlystop = function() {
makeIntegerLearnerParam(id = "early_stopping_rounds", default = 1, lower = 1L, tunable = FALSE),
makeIntegerLearnerParam(id = "max.nrounds", default = 10^6L, lower = 1L, upper = 10^7L),
makeUntypedLearnerParam(id = "early.stopping.data"),
makeLogicalLearnerParam(id = "maximize", default = NULL, special.vals = list(NULL), tunable = FALSE),
makeNumericLearnerParam(id = "scale_pos_weight", lower = 0),
makeIntegerLearnerParam(id = "nthread", lower = 1L, tunable = FALSE)
),
Expand Down
3 changes: 0 additions & 3 deletions R/RLearner_regr_xgboost.custom.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ makeRLearner.regr.xgboost.custom = function() {
cl = "regr.xgboost.custom",
package = "xgboost",
par.set = makeParamSet(
# we pass all of what goes in 'params' directly to ... of xgboost
#makeUntypedLearnerParam(id = "params", default = list()),
makeDiscreteLearnerParam(id = "booster", default = "gbtree", values = c("gbtree", "gblinear", "dart")),
makeUntypedLearnerParam(id = "watchlist", default = NULL, tunable = FALSE),
makeNumericLearnerParam(id = "eta", default = 0.3, lower = 0, upper = 1),
Expand All @@ -29,7 +27,6 @@ makeRLearner.regr.xgboost.custom = function() {
makeNumericLearnerParam(id = "tweedie_variance_power", lower = 1, upper = 2, default = 1.5, requires = quote(objective == "reg:tweedie")),
makeIntegerLearnerParam(id = "nthread", lower = 1L, tunable = FALSE),
makeIntegerLearnerParam(id = "nrounds", default = 1L, lower = 1L),
# FIXME nrounds seems to have no default in xgboost(), if it has 1, par.vals is redundant
makeUntypedLearnerParam(id = "feval", default = NULL, tunable = FALSE),
makeIntegerLearnerParam(id = "verbose", default = 1L, lower = 0L, upper = 2L, tunable = FALSE),
makeIntegerLearnerParam(id = "print_every_n", default = 1L, lower = 1L, tunable = FALSE,
Expand Down
1 change: 1 addition & 0 deletions R/RLearner_regr_xgboost.earlystop.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ makeRLearner.regr.xgboost.earlystop = function() {
makeIntegerLearnerParam(id = "early_stopping_rounds", default = 1, lower = 1L, tunable = FALSE),
makeIntegerLearnerParam(id = "max.nrounds", default = 10^6L, lower = 1L, upper = 10^7L),
makeUntypedLearnerParam(id = "early.stopping.data"),
makeLogicalLearnerParam(id = "maximize", default = NULL, special.vals = list(NULL), tunable = FALSE),
makeIntegerLearnerParam(id = "nthread", lower = 1L, tunable = FALSE)
),
properties = c("numerics", "weights", "missings"),
Expand Down
4 changes: 2 additions & 2 deletions R/autoxgboost.R
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ autoxgboost = function(task, measure = NULL, control = NULL, iterations = 160L,
}

base.learner = makeLearner("classif.xgboost.earlystop", id = "classif.xgboost.earlystop", predict.type = predict.type,
eval_metric = eval_metric, objective = objective, early_stopping_rounds = early.stopping.rounds,
eval_metric = eval_metric, objective = objective, early_stopping_rounds = early.stopping.rounds, maximize = !measure$minimize,
max.nrounds = max.nrounds, par.vals = pv)

} else if (tt == "regr") {
Expand All @@ -122,7 +122,7 @@ autoxgboost = function(task, measure = NULL, control = NULL, iterations = 160L,
eval_metric = "rmse"

base.learner = makeLearner("regr.xgboost.earlystop", id = "regr.xgboost.earlystop",
eval_metric = eval_metric, objective = objective, early_stopping_rounds = early.stopping.rounds,
eval_metric = eval_metric, objective = objective, early_stopping_rounds = early.stopping.rounds, maximize = !measure$minimize,
max.nrounds = max.nrounds, par.vals = pv)

} else {
Expand Down

0 comments on commit b629639

Please sign in to comment.