Error in Oversampling in R

I am working on SMOTE using DMwR package. i tried oversampling of data but i got error saying The response variable must have 2 levels.
what does it mean ? How can i solve this error ?
i tried following code:

> over <- ovun.sample(tumor_stage~., data = train, method = "over", N = 760)$data

got error

Error in (function (formula, data, method, subset, na.action, N, p = 0.5,  : 
 The response variable must have 2 levels.````

how many levels are there in train$tumor_stage ?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

in train$tumor_stage has 10 levels

as an experiment, if you recoded it down to two levels, would the function run without error ? it does seem to me to be complaining about your response variable having not exactly two levels.

If you need to model 10 levels, you will need an appropriate tool for the job. Perhaps others here have suggestions

1 Like

with 2 levels it works..