topepo / caret

caret (Classification And Regression Training) R package that contains misc functions for training and plotting classification and regression models
http://topepo.github.io/caret/index.html
1.61k stars 632 forks source link

varImp error with bagFDA: could not find function "." #1349

Open yctai105 opened 1 year ago

yctai105 commented 1 year ago

Hi,

I got an error when I ran varImp() on the train() output object using bagged models, e.g. bagFDA, bagEarth. Please see below. Thanks!

Minimal dataset:

library(caret)
set.seed(1)
X <- iris[1:100,1:4]
y <- iris[1:100,5]
y=factor(y, levels=c("setosa", "versicolor"))

Minimal, runnable code:

model_class <- train(
  X, y, 
  metric='ROC', 
method="bagFDA",
  trControl=trainControl(
    method="cv", 
    number=5,
    classProbs=TRUE, 
    summaryFunction=twoClassSummary,
    savePredictions="final")
)
> varImp(model_class)
Error in .(var) : could not find function "."

Session Info:

>sessionInfo()
caret_6.0-94
tinaty commented 9 months ago

Hi @yctai105 just to check have you resolved this issue? I have experienced the same error, and I also used the version of caret 6.0-94. Thank you