invalid class “km” object: the number of experiments must be larger than the spatial dimension
dipenpatel235 opened this issue · 7 comments
Can u help me to fix out this issue.
i have already tried to fix but unable to fix it.
library(rpart)
library(rjson)
library(mlrMBO)
library(synchronicity)
ps <- makeParamSet(
makeIntegerParam("AE_UNITS1", lower = 4, upper = 5),
makeIntegerParam("AE_UNITS2", lower = 4, upper = 5),
makeIntegerParam("AE_UNITS3", lower = 2, upper = 3),
makeNumericParam("DROPOUT1", lower = 0.1, upper = 0.5),
makeNumericParam("DROPOUT2", lower = 0.1, upper = 0.5),
makeNumericParam("DROPOUT3", lower = 0.5, upper = 0.999),
makeIntegerParam("LB_L2", lower = -5, upper = -1),
makeIntegerParam("MY_LR", lower = 1, upper = 5),
makeIntegerParam("MY_EXPONENT", lower = -4, upper = -1)
)
des <- generateDesign(n = 6, par.set = ps)
des$y <- 9999
ctrl <- makeMBOControl(output.num.format = "%.7g")
ctrl <- setMBOControlInfill(ctrl, crit = crit.ei)
opt.state <- initSMBO(
par.set = ps,
design = des,
control = ctrl,
minimize = TRUE,
noisy = FALSE)
#mutex
m = boost.mutex()
lock(m)
prop <- proposePoints(opt.state)
unlock(m)
print(prop)
Error in validObject(model, complete = TRUE) :
invalid class “km” object: the number of experiments must be larger than the spatial dimension
Calls: proposePoints ... trainLearner.regr.km -> do.call -> -> validObject
Execution halted
The error informs you that the initial design size should be larger than the number of parameters you are optimizing for. You could increase the size of the initial design by increasing the n
in generateDesign
to above 9.
(When I run your example with just that, I still get an error because apparently the model in the background (DiceKriging) can not handle constant values well.)
des <- generateDesign(n = 10, par.set = ps)
des$y <- 1:10
works for me.
@mb706 yes DiceKriging is not able to handle constant values well.
so i think we need to file bug them to also ?
I did that, but I don't know how responsive they will be. If you frequently get constant values from your use case then you should probably handle that case separately, but it would be an unusual usecase.
I am assuming we have fixed the specific problem here so I am closing this issue.
thanks @mb706
and according to your given value it is working fine to me also.
If you frequently get constant values from your use case then you should probably handle that case separately, but it would be an unusual usecase.
You can use the removeConstantFeaturesWrapper
from mlr on the regression learner that is used as a surrogate for such case. Be aware that this will prevent any exploration in the dimension/feature that is removed.
@mb706
still i get below error when i am continues executing that code by changing value given by you.
<simpleError in validObject(model, complete = TRUE): invalid class “km” object: the number of experiments must be larger than the spatial dimension>
is there any way to we can set any dynamic value of n
and 1:10
?
des <- generateDesign(n = 10, par.set = ps)
des$y <- 1:10
Unrelated to the error. Seeing the following lines
des <- generateDesign(n = 6, par.set = ps)
des$y <- 9999
It case it is part of your real code: You cannot just initialize the design with some random values for y
. This will totally break the MBO process. They have to be real outcomes of the objective you want to tune.