Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in chol.default(R) :the leading minor of order 1 is not positive definite as using the classif.naiveBayes #2803

Closed
Seager1989 opened this issue Feb 1, 2021 · 7 comments

Comments

@Seager1989
Copy link

Seager1989 commented Feb 1, 2021

I did try to tune a naive Bayes learner as the following code, but an error occurred as the following (Error in chol.default(R) :
the leading minor of order 1 is not positive definite). The traceback and the data are attached also. I am not so familiar with the internal architecture of tuneParams.

Can anyone give a suggestion on what is the problem and how to fix this problem? Thank you

Code

MLNBC <- makeLearner("classif.naiveBayes",config = list(on.learner.error = "quiet",on.learner.warning = "quiet",on.par.without.desc= "quiet",on.par.out.of.bounds= "quiet",on.measure.not.applicable= "quiet",show.learner.output= TRUE,on.error.dump=FALSE))
PSNBC <- makeParamSet(makeNumericParam(id="laplace",lower=0,upper=10))
taskML = makeClassifTask(data=MLdatasetHopt


,target=colnames(MLdatasetHopt)[dim(MLdatasetHopt)[2]])
MLNBCOPT=tuneParams(MLNBC,taskML,cv5,par.set=PSNBC,control=controlALL,measures=list(acc,setAggregation(acc,test.sd)))

Errors:

[Tune] Started tuning learner classif.naiveBayes for parameter set:
           Type len Def     Constr Req Tunable Trafo
laplace numeric   -   - 0.01 to 10   -    TRUE     -
With control class: TuneControlMBO
Imputation value: 0.01
[Tune-x] 1: laplace=5.5
[Tune-y] 1: acc.test.mean=0.9100000,acc.test.sd=0.0370810; time: 0.0 min
[Tune-x] 2: laplace=1.7
[Tune-y] 2: acc.test.mean=0.9100000,acc.test.sd=0.0370810; time: 0.0 min
[Tune-x] 3: laplace=9.19
[Tune-y] 3: acc.test.mean=0.9100000,acc.test.sd=0.0370810; time: 0.0 min
[Tune-x] 4: laplace=3.47
[Tune-y] 4: acc.test.mean=0.9100000,acc.test.sd=0.0370810; time: 0.0 min
Error in chol.default(R) : 
  the leading minor of order 1 is not positive definite

Traceback
Traceback.txt
Data
MLdatasetHopt.txt

@pat-s
Copy link
Member

pat-s commented Feb 1, 2021

possibly related #2738

@Seager1989
Copy link
Author

Thank you for your response. I understand this may be not the problem of mlr, but why the configureMlr can not handle this type of error by setting on.learner.error = "warn"?

@Seager1989
Copy link
Author

I checked the error again and found it may be related to the Kriging model fitting after the evaluation of the initial DOE. This may be related to the mlr.

This is because the error appeared after four evaluations even using different datasets. I have only one hyperparameter for tunning, so the default initial size of DOE is 4. The error is due to the fitting of the Kriging surrogate model in the sequential model-based optimization. This is why the error always appears after four evaluations. I do not know if you have some ideas to change something to avoid this type of error.

@pat-s
Copy link
Member

pat-s commented Feb 2, 2021

If you think this an error with MBO please open an error including a reprex in mlr-org/mlrMBO.

@Seager1989
Copy link
Author

Thank you for your suggestion. I am also a little bit confused about the boundary of mlr and mlrMBO. I did use the makeTuneControlMBO and tuneParams, which are the function of mlr. In this way, this is an issue on the mlr or mlrMBO?

@pat-s
Copy link
Member

pat-s commented Feb 5, 2021

{mlrMBO} provides tuning methods for {mlr}.

The error looks like a learner issue so it relates to {mlr}.
Note that {mlr} is officially deprecated - we suggest to use {mlr3} instead.

For more help, please post a full reproducible example.

@pat-s
Copy link
Member

pat-s commented Feb 15, 2021

Closing due to missing reprex and no response.

@pat-s pat-s closed this as completed Feb 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants