k-fold cross validation - how to get the prediction automatically?

前端 未结 2 1968
情话喂你
情话喂你 2021-02-03 15:53

This may be a silly question but I just can\'t find a package to do that...I know I can write some codes to get what I want but it would be nice to have a function to do it auto

2条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-03 16:38

    I would suggest investigating cv.glm from package boot, because you are working with a glm model. Another option would be package cvTools. I've found it more useful to write up my own function for CV, though. It sounds like you want a CV function that ends halfway, and most CV functions I've seen will average the prediction error over all the validation sets and return just the average (which, of course, is the definition of cross validation).

提交回复
热议问题