Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
include some tests (that are still failing (probably))
  • Loading branch information
PhilippPro committed Sep 7, 2018
commit 15b2d0cf060129a50c8c97cd48d1c3dc15fe7981
20 changes: 10 additions & 10 deletions R/RLearner_classif_liquidSVM.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ makeRLearner.classif.liquidSVM = function() {
package = "liquidSVM",
par.set = makeParamSet(
makeIntegerLearnerParam(id = "d", lower = 0L),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should not be tunable (tunable = FALSE).

makeLogicalLearnerParam(id = "scale", default = TRUE),
makeIntegerLearnerParam(id = "threads", default = 1L, lower = -1L),
makeIntegerLearnerParam(id = "partition_choice", default = 0L, lower = 0L),
makeIntegerLearnerParam(id = "grid_choice", default = 0L, lower = -2L, upper = 2L),
makeIntegerLearnerParam(id = "adaptivity_control", default = 0L, lower = 0L, upper = 2L),
makeIntegerLearnerParam(id = "random_seed", default = 1L),
makeLogicalLearnerParam(id = "scale"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default for this is TRUE.

makeIntegerLearnerParam(id = "threads", lower = -1L),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default is 0.

makeIntegerLearnerParam(id = "partition_choice", lower = 0L),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default is 0.

makeIntegerLearnerParam(id = "grid_choice", lower = -2L, upper = 2L),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this interact with gamma_steps, lambda_steps, etc? Are these options mutually exclusive?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And all of these options should be not tunable.

makeIntegerLearnerParam(id = "adaptivity_control", lower = 0L, upper = 2L),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default is 0.

makeIntegerLearnerParam(id = "random_seed", default = 1),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find any documentation on what the default random seed is -- where did you find this? It also shouldn't be tunable.

makeIntegerLearnerParam(id = "fold"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should that be folds? And there should be a minimum for this (and again not tunable).

makeIntegerLearnerParam(id = "clipping"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that the minimum is -1. Also probably shouldn't be tunable.

makeIntegerLearnerParam(id = "gamma_steps", lower = 0),
makeNumericLearnerParam(id = "min_gamma", lower = 0),
makeNumericLearnerParam(id = "max_gamma", lower = 0),
makeNumericLearnerParam(id = "gamma", lower = 0),
makeNumericVectorLearnerParam(id = "gammas", lower = 0),
makeIntegerLearnerParam(id = "lambda_steps", lower = 0),
makeNumericLearnerParam(id = "min_lambda", lower = 0),
makeNumericLearnerParam(id = "max_lambda", lower = 0),
makeNumericLearnerParam(id = "lambdas", lower = 0),
makeNumericLearnerParam(id = "c_values", lower = 0),
makeLogicalLearnerParam(id = "useCells", default = FALSE)
makeNumericVectorLearnerParam(id = "lambdas", lower = 0),
makeNumericVectorLearnerParam(id = "c_values", lower = 0),
makeLogicalLearnerParam(id = "useCells")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that the default for this is FALSE. Should be not tunable.

),
properties = c("twoclass", "multiclass", "numerics", "factors"),
name = "Support Vector Machines (liquidSVM)",
Expand Down
20 changes: 10 additions & 10 deletions R/RLearner_regr_liquidSVM.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,24 @@ makeRLearner.regr.liquidSVM = function() {
package = "liquidSVM",
par.set = makeParamSet(
makeIntegerLearnerParam(id = "d", lower = 0L),
makeLogicalLearnerParam(id = "scale", default = TRUE),
makeIntegerLearnerParam(id = "threads", default = 1L, lower = -1L),
makeIntegerLearnerParam(id = "partition_choice", default = 0L, lower = 0L),
makeIntegerLearnerParam(id = "grid_choice", default = 0L, lower = -2L, upper = 2L),
makeIntegerLearnerParam(id = "adaptivity_control", default = 0L, lower = 0L, upper = 2L),
makeIntegerLearnerParam(id = "random_seed", default = 1L),
makeLogicalLearnerParam(id = "scale"),
makeIntegerLearnerParam(id = "threads", lower = -1L),
makeIntegerLearnerParam(id = "partition_choice", lower = 0L),
makeIntegerLearnerParam(id = "grid_choice", lower = -2L, upper = 2L),
makeIntegerLearnerParam(id = "adaptivity_control", lower = 0L, upper = 2L),
makeIntegerLearnerParam(id = "random_seed", default = 1),
makeIntegerLearnerParam(id = "fold"),
makeIntegerLearnerParam(id = "clipping"),
makeIntegerLearnerParam(id = "gamma_steps", lower = 0),
makeNumericLearnerParam(id = "min_gamma", lower = 0),
makeNumericLearnerParam(id = "max_gamma", lower = 0),
makeNumericLearnerParam(id = "gamma", lower = 0),
makeNumericVectorLearnerParam(id = "gammas", lower = 0),
makeIntegerLearnerParam(id = "lambda_steps", lower = 0),
makeNumericLearnerParam(id = "min_lambda", lower = 0),
makeNumericLearnerParam(id = "max_lambda", lower = 0),
makeNumericLearnerParam(id = "lambdas", lower = 0),
makeNumericLearnerParam(id = "c_values", lower = 0),
makeLogicalLearnerParam(id = "useCells", default = FALSE)
makeNumericVectorLearnerParam(id = "lambdas", lower = 0),
makeNumericVectorLearnerParam(id = "c_values", lower = 0),
makeLogicalLearnerParam(id = "useCells")
),
properties = c( "numerics", "factors"),
name = "Support Vector Machines (liquidSVM)",
Expand Down
38 changes: 38 additions & 0 deletions tests/testthat/test_classif_liquidSVM.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
context("classif_liquidSVM")

test_that("classif_liquidSVM", {
requirePackagesOrSkip("liquidSVM", default.method = "load")
parset.list = list(
list(),
list(partition_choice = 6),
list(partition_choice = 5),
list(grid_choice = 1),
list(grid_choice = 2),
list(adaptivity_control = 1),
list(adaptivity_control = 2),
list(clipping = -1),
list(clipping = 0),
list(gamma_steps = 5, min_gamma = 0.1, max_gamma = 25, lambda_steps = 5, min_lambda = 0.1, max_lambda = 25),
list(useCells = TRUE),
list(gammas = c(0.1,1,10), lambdas = c(0.1,1,10), c_values = c(0.1,1,10))
)
# Kernel, more advanced parameters...

old.predicts.list = list()
for (i in seq_along(parset.list)) {
parset = parset.list[[i]]
pars = list(x = multiclass.formula, y = multiclass.train)
pars = c(pars, parset)
set.seed(getOption("mlr.debug.seed"))
set.seed(123)
m = do.call(liquidSVM::svm, pars)
set.seed(getOption("mlr.debug.seed"))
set.seed(123)
p = predict(m, newdata = multiclass.test, type = "response")
old.predicts.list[[i]] = p
}

testSimpleParsets("classif.liquidSVM", multiclass.df, multiclass.target,
multiclass.train.inds, old.predicts.list, parset.list[1])

})
33 changes: 33 additions & 0 deletions tests/testthat/test_regr_liquidSVM.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
context("regr_liquidSVM")

test_that("regr_liquidSVM", {
requirePackagesOrSkip("liquidSVM", default.method = "load")

parset.list = list(
list(),
list(partition_choice = 6),
list(partition_choice = 5),
list(grid_choice = 1),
list(grid_choice = 2),
list(adaptivity_control = 1),
list(adaptivity_control = 2),
list(clipping = -1),
list(clipping = 0),
list(gamma_steps = 5, min_gamma = 0.1, max_gamma = 25, lambda_steps = 5, min_lambda = 0.1, max_lambda = 25),
list(useCells = TRUE),
list(gammas = c(0.1,1,10), lambdas = c(0.1,1,10), c_values = c(0.1,1,10))
)
old.predicts.list = list()
for (i in seq_along(parset.list)) {
parset = parset.list[[i]]
pars = list(x = regr.formula, y = regr.train)
pars = c(pars, parset)
set.seed(getOption("mlr.debug.seed"))
m = do.call(liquidSVM::svm, pars)
p = predict(m, newdata = regr.test)
old.predicts.list[[i]] = p
}

testSimpleParsets("regr.liquidSVM", regr.df, regr.target, regr.train.inds, old.predicts.list, parset.list)
})