javed khan
2020-Jun-09  21:08 UTC
[R] Error in code (no applicable method for 'train' applied to an object of class "formula" )
Greetings, till yesterday the following code was executed normally but
today, it give me the following error:
 Error in UseMethod("train") :
  no applicable method for 'train' applied to an object of class
"formula"
I have tried other methods also such as rf, pls, but all gives the same
error message. Could you plz guide why it happens?
data=readARFF("albrecht.arff")
index <- createDataPartition(data$Effort, p = .70,list = FALSE)
tr <- data[index, ]
ts <- data[-index, ]
CV <- trainControl(method = "repeatedcv", number=10, repeats=10)
m1 <- train(Effort ~ ., data = tr,
                 method = "mlp",
                 metric = "RMSE",
                 preProc = c("center", "scale"),
                 trControl = CV)
m1
My data structure is the following
structure(list(Input = c(25, 193, 70, 40), Output = c(150, 98,
27, 60), Inquiry = c(75, 70, 0, 20), File = c(60, 36, 12, 12),
    FPAdj = c(1, 1, 0.8, 1.15), RawFPcounts = c(1750, 1902, 535,
    660), AdjFP = c(1750, 1902, 428, 759), Effort = c(102.4,
    105.2, 11.1, 21.1)), row.names = c(NA, 4L), class = "data.frame")
	[[alternative HTML version deleted]]