0

Running the train algorithm for biopsy dataset using 'glm' method I had the error due to invalid number of intervals.

I tried to run the R code:

biopsy_ = na.omit(biopsy[,-c(1)]) # 1 = ID

# 
biopsy_$class = 1

#   
ctrl <- trainControl(method="repeatedcv", number= 100, repeats=1)

fit <- train(class~., data=biopsy_,
         method="glm", 
         family="binomial",
         trControl=ctrl, 
         preProcess = c("center", "scale"))
fit

But I received the following error:

Error in cut.default(y, breaks, include.lowest = TRUE) : 
invalid number of intervals

1 Answers1

0

Do you have more than 100 rows? How many more?

Brad
  • 580
  • 4
  • 19
  • 683 rows after applied this code biopsy_ = na.omit(biopsy[,-c(1)]) # ID & NA excluded – Marcos de Paula Jun 20 '19 at 03:06
  • Does the response variable 'class' only have 2 levels? and 2 level labels - remember factor levels can be empty. Use droplevels to remove empty factor level labels. Is it set to a factor? – Brad Jun 23 '19 at 05:14