Try to search your question here, if you can't find : Ask Any Question Now ?

Exploratory analysis/ K Fold Cross Validation in R

HomeCategory: stackoverflowExploratory analysis/ K Fold Cross Validation in R
rupesh asked 3 weeks ago

I am having trouble with a K Fold Cross Validation in R , please see attached

    sample <- sample.int(n = nrow(data), size = floor(.50*nrow(data)), replace = F)
train <- data[sample, ]
test  <- data[-sample, ]
### Define train control for k fold cross validation
train_control <- trainControl(method="cv", number=10)
# Fit Naive Bayes Model
model <- train(SIGNAL_FLAG~., data=data, trControl=train_control, method="nb")
 Summarise Results
print(model)

I am getting multiple errors like

Error in na.fail.default(list(SIGNAL_FLAG = c(1L, 2L, 1L, 2L, 1L, 2L, : missing values in object

and

Error in `contrasts<-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels

I have never touched or even seen r before this and do not have a background in stat… I could really use some help… I am leaving a link to the entire script and the data set below.

dataset

https://drive.google.com/file/d/1tXx6f9hRWthI-i4TLERympeXskaN7AoJ/view?usp=sharing

script
https://drive.google.com/file/d/1gipLkK11Gox_mlaZQX3aauTZlyhuB8_z/view?usp=sharing

1 Answers
Best Answer
Jyoti answered 3 weeks ago
Your Answer

8 + 9 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com