I'm new to Caret and I've been trying a couple things to get the hang of things. But this error happened to me and I'm not sure why.
I've been trying to train a model with some data I got from "PimaIndiansDiabetes". These are the "x" and "y" I'm using:
>str(pima.Datos.Train[pima.Vars.Entrada.Usadas])
'data.frame': 615 obs. of 8 variables:
\$ pregnant: num 6 1 8 1 3 10 2 8 4 10 ...
\$ glucose : num 148 85 183 89 78 115 197 125 110 139 ...
\$ pressure: num 72 66 64 66 50 0 70 96 92 80 ...
\$ triceps : num 35 29 0 23 32 0 45 0 0 0 ...
\$ insulin : num 0 0 0 94 88 0 543 0 0 0 ...
\$ mass : num 33.6 26.6 23.3 28.1 31 35.3 30.5 0 37.6 27.1 ...
\$ pedigree: num 0.627 0.351 0.672 0.167 0.248 ...
\$ age : num 50 31 32 21 26 29 53 54 30 57 ...>str(pima.Datos.Train[pima.Var.Salida.Usada])
'data.frame': 615 obs. of 1 variable:
\$ diabetes: Factor w/ 2 levels "neg","pos": 2 1 2 1 2 1 2 2 1 1 ...>pima.modelo <- train(pima.Datos.Train[pima.Vars.Entrada.Usadas],
pima.Datos.Train[pima.Var.Salida.Usada],
method='mlp')
train returns an Error: Please make sure y
is a factor or numeric value.
But as far as I know, "y" is a factor, so I'm not really sure where the Error comes from. ¿Any help with this?
Thanks in advance