I am trying to use SMOTE to correct imbalance in my multi-class classification problem. Although SMOTE works perfectly on the iris dataset as per the SMOTE help document, it does not work on a similar dataset. Here is how my data looks. Note it has three classes with values 1, 2, 3.
> data
looking risk every status
1 0 1 0 1
2 0 0 0 1
3 0 0 0 2
4 0 0 0 1
5 0 0 0 1
6 3 0 0 1
7 0 0 0 1
8 0 0 0 1
9 0 1 0 1
10 0 0 0 1
11 0 0 0 3
12 0 0 0 1
13 0 0 0 1
14 0 0 0 1
15 0 0 0 2
It is in the form of dataframe, same as iris:
> class(data)
[1] "data.frame"
Here is my code using SMOTE and the error that it throws:
> newData <- SMOTE(status ~ ., data, perc.over = 600,perc.under=100)
Error in scale.default(T, T[i, ], ranges) : subscript out of bounds
In addition: Warning messages:
1: In FUN(newX[, i], ...) :
no non-missing arguments to max; returning -Inf
2: In FUN(newX[, i], ...) :
no non-missing arguments to max; returning -Inf
3: In FUN(newX[, i], ...) :
no non-missing arguments to max; returning -Inf
4: In FUN(newX[, i], ...) : no non-missing arguments to min; returning Inf
5: In FUN(newX[, i], ...) : no non-missing arguments to min; returning Inf
6: In FUN(newX[, i], ...) : no non-missing arguments to min; returning Inf