[R] caret package: arguments passed to the classification or regression routine

Peter Tait petertait at sympatico.ca
Thu Sep 18 20:22:54 CEST 2008


Hi,
I am having problems passing arguments to method="gbm" using the train() 
function.

I would like to train gbm using the laplace distribution or the quantile 
distribution.

here is the code I used and the error:

gbm.test <- train(x.enet, y.matrix[,7],
   method="gbm",
   distribution=list(name="quantile",alpha=0.5), verbose=FALSE,
   trControl=trainControl(method="cv",number=5),
   tuneGrid=gbmGrid
)
Model 1: interaction.depth=1, shrinkage=0.1, n.trees=300
collapsing over other values of n.trees
Error in gbm.fit(trainX, modY, interaction.depth = 
tuneValue$.interaction.depth,  :
  formal argument "distribution" matched by multiple actual arguments

The same error occured with distribution="laplace".

I also tried the following without and success :

gbm.test <- train(x.enet, y.matrix[,7],
   method="gbm",
   list(distribution="laplace", verbose=FALSE),
   trControl=trainControl(method="cv",number=2),
   tuneGrid=gbmGrid
)
Model 1: interaction.depth=1, shrinkage=0.1, n.trees=300
collapsing over other values of n.trees
Error in if (is.null(offset) || (offset == 0)) { :
  missing value where TRUE/FALSE needed
In addition: Warning message:
In gbm.fit(trainX, modY, interaction.depth = tuneValue$.interaction.depth,  
:
  NAs introduced by coercion

Any help would be appreciated.
Cheers
Peter



More information about the R-help mailing list