r - Error in train.default -


i trying build classifier code having issues training parameters

my label parameter " class "

here code , snippet of data

# load library library(mlbench) library(caret) # load dataset titanicdf <- read.csv(file="c:/users/yobo/desktop/full_dataset2.csv", header=true, sep=",") head(titanicdf)  id   length width petal_length sepal_length class 1  1        3423   17.2.2       17.2.2   0 1  1        3223   11.2.2      17.2.2   0 1  1        3223   10.2.2     21.2.2   1 1  1        3123   16.2.2     22.2.2   1 1  1        344   14.2.2     24.2   1 1  1        3456   15.2.2     65.2.2   1 1  1        3112   12.2.1    14.2.2   0 # prepare training scheme control <- traincontrol(method="repeatedcv", number=10, repeats=3)     # train lvq model     set.seed(7)    modellvq <- train(titanicdf$class, data=titanicdf, method="lvq", trcontrol=control) 

i got error:

error in train.default(titanicdf$class, data = titanicdf, method = "lvq",  :    argument "y" missing, no default 

i tried

> modellvq <- train(data$class, data=titanicdf, method="lvq", trcontrol=control) error in data$class : object of type 'closure' not subsettable 

that still gave error. issue?

try

modellvq <- train(class~width+petal_length+sepal_length, data=titanicdf, method="lvq", trcontrol=control) 

you need specificity formula model knows how classification.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -