[R] #library("CHAID") - Cross validation for chaid
mxkuhn at gmail.com
Mon Jan 5 17:56:18 CET 2015
You can create your own:
I put a prototype together. Source this file:
then try this:
### fit tree to subsample
USvoteS <- USvote[sample(1:nrow(USvote), 1000),]
## You probably don't want to use `train.formula` as
## it will convert the factors to dummy variables
mod <- train(x = USvoteS[,-1], y = USvoteS$vote3,
method = modelInfo,
trControl = trainControl(method = "cv"))
On Mon, Jan 5, 2015 at 7:11 AM, Rodica Coderie via R-help
<r-help at r-project.org> wrote:
> Is there an option of cross validation for CHAID decision tree? An example of CHAID is below:
> example("chaid", package = "CHAID")
> How can I use a 10 fold cross-validation for CHAID?
> I've read that caret package is to cross-validate on many times of models, but model CHAID is not in caret's built-in library.
> model <- train(vote3 ~., data = USvoteS, method='CHAID', tuneLength=10,trControl=trainControl(method='cv', number=10, classProbs=TRUE, summaryFunction=twoClassSummary))
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help