|
|
@@ -16,7 +16,7 @@ from tensorflow.keras.layers import Lambda
|
|
|
|
|
|
from sklearn.utils import shuffle
|
|
|
|
|
|
-from library.NNSearch import NNSearch
|
|
|
+from library.NNSearch import NNSearch, randomIndices
|
|
|
|
|
|
import warnings
|
|
|
warnings.filterwarnings("ignore")
|
|
|
@@ -347,7 +347,7 @@ class NextConvGeN(GanBaseClass):
|
|
|
def indexToBatches(min_idx):
|
|
|
self.timing["NBH"].start()
|
|
|
## generate minority neighbourhood batch for every minority class sampls by index
|
|
|
- min_batch_indices = shuffle(self.nmbMin.neighbourhoodOfItem(min_idx))
|
|
|
+ min_batch_indices = self.nmbMin.neighbourhoodOfItem(min_idx)
|
|
|
min_batch = self.nmbMin.getPointsFromIndices(min_batch_indices)
|
|
|
|
|
|
## generate random proximal majority batch
|
|
|
@@ -468,8 +468,11 @@ class NextConvGeN(GanBaseClass):
|
|
|
## min_idxs -> indices of points in minority class
|
|
|
## gen -> convex combinations generated from each neighbourhood
|
|
|
self.timing["BMB"].start()
|
|
|
- indices = [i for i in range(self.minSetSize) if i not in min_idxs]
|
|
|
- r = self.nmbMin.basePoints[shuffle(indices)[0:self.gen]]
|
|
|
+ # indices = [i for i in range(self.minSetSize) if i not in min_idxs]
|
|
|
+ # r = self.nmbMin.basePoints[shuffle(indices)[0:self.gen]]
|
|
|
+
|
|
|
+ indices = randomIndices(self.minSetSize, outputSize=self.gen, indicesToIgnore=min_idxs)
|
|
|
+ r = self.nmbMin.basePoints[indices]
|
|
|
self.timing["BMB"].stop()
|
|
|
return r
|
|
|
|