The code has a bug when removing. The last loop should be written as follows
for j = 1:length(original_mark)
neighbors = I(j, 2:4);
len = length(find(original_mark(neighbors) ~= original_mark(j,1)));
if(len >= 2)
if(original_mark(j,1) == classlabel)
train_incl(neighbors(original_mark(neighbors) ~= original_mark(j,1)),1) = 0;
train_incl(j,1) = 0;
The current code keeps changing the first 3 elements in train_incl.
Hi, when I used the SMOTE function, I get the next error. It was caused because an entry row of the I matrix is [0 0 0 0] (line 14). Why did this happen?.
Attempted to access P(0,:); index must be a positive integer or logical.
Error in SMOTE (line 24)
new_P=(1-th).*P(i,:) + th.*P(index,:);
Thanks and regards, Carlos