Closed gtoti closed 8 years ago
If you type warnings()
you'll see that in both cases the model fit failed for every resample.
You can try fitting a single model to your data with the getModelInfo('treebag')[['treebag']]$fit
and getModelInfo('treebag')[['treebag']]$predict
to help you figure out what's wrong with the model or your data.
After a closer look at the warnings, I found out what was bothering the neural network:
Warning messages:
1: In eval(expr, envir, enclos) :
model fit failed for Resample01: layer1=1, layer2=0, layer3=0 Error in parse(text = x, keep.source = FALSE) :
<text>:1:27: unexpected symbol
1: .outcome ~ age+jobclass2. Information
^
Which to my understanding means it was struggling with the spaces in the column names. After renaming the columns using space-free strings, I was able to produce a model.
"treebag" was struggling with the same issue, although the error I was getting here was more cryptical (I would have not made the connection with the spaces issue):
Warning messages:
1: In eval(expr, envir, enclos) :
model fit failed for Resample01: parameter=none Error in `[.data.frame`(m, labs) : undefined columns selected
I did not find trying to fit a single model particularly informative, unless maybe I did not do it right. This is what I typed an the output I got:
> getModelInfo('treebag')[['treebag']]$fit
function(x, y, wts, param, lev, last,classProbs, ...) {
theDots <- list(...)
if(!any(names(theDots) == "keepX")) theDots$keepX <- FALSE
modelArgs <- c(list(X = x, y = y), theDots)
if(!is.null(wts)) modelArgs$weights <- wts
do.call("ipredbagg", modelArgs)
}
In the end, "Something is wrong; all the RMSE metric values are missing" can mean pretty much anything went wrong with the model fitting, did I get this right?
Thanks for your help. Pieces of caret are slowly but surely falling into place...
"Something is wrong; all the RMSE metric values are missing" can mean pretty much anything went wrong with the model fitting, did I get this right?
Yup. It basically always means the model fit failed. Usually this is a problem with the base model itself, sometimes it's a problem with the pre-processing caret does.
@topepo Maybe caret should raise a warning for columns with spaces in them and suggest running make.names(names(x))
on them?
Hello,
I am practicing on using caret for regression and in several occasions I run into this error message:
I don't seem to be able to get to the root of it. It is preventing me from using many available models.
Below, I am reporting 2 examples.
Example 1 In this example, I am using a simple dataset with random NAs added to make it more realistic.
Example 2 The problem presents itself when other models are used, even with complete datasets (no NAs)
I was surprised to see the models struggling with these very simple scenarios. I would appreciate any help in understanding what is causing the problem.