def balancing(x, y):
print(y.count(0), y.count(1))
if y.count(0) > y.count(1):
pos_idx = [i for i, l in enumerate(y) if l == 1]
neg_idx = [i for i, l in enumerate(y) if l == 0]
pos_idx = shuffle(pos_idx)
neg_idx = shuffle(neg_idx)
neg_idx = neg_idx[:len(pos_idx) * 5]
check_ids = [False] * len(x)
for idx in pos_idx:
check_ids[idx] = True
for idx in neg_idx:
check_ids[idx] = True
x = [s for i, s in enumerate(x) if check_ids[i]]
y = [s for i, s in enumerate(y) if check_ids[i]]
And
for idx in pos_idx:
check_ids[idx] = True
for idx in neg_idx:
check_ids[idx] = True
Both “for” loops make check_ids[] equal to true, is that right?
And
Both “for” loops make check_ids[] equal to true, is that right?