def get_prototypes(self, X, y): if self.mode == 1: rps = ReductionBySpacePartitioning1(b=self.b) elif self.mode == 2: rps = ReductionBySpacePartitioning2(b=self.b) elif self.mode == 3: rps = ReductionBySpacePartitioning3() elif self.mode == 4: rps = CNN() elif self.mode == 5: rps = ENN() elif self.mode == 6: rps = RENN() elif self.mode == 7: rps = SGP() else: rps = TomekLinks() r = rps.fit(X, y) if (self.mode < 4): r.reduce_data() #print rps.get_prototypes() return rps.get_prototypes()
plot_and_save(X_orig, y_orig, title='ORIGINAL', filename='images/ORIG_' + dataset + '.png') # creating prototype generation object for mode in range(1,3): title = "" if mode == 1: rps = ReductionBySpacePartitioning1(b=30) title = "ReductionBySpacePartitioning 1 - b =30" elif mode == 2: rps = ReductionBySpacePartitioning2(b=30) title = "ReductionBySpacePartitioning 2 - b =30" elif mode == 3: rps = ReductionBySpacePartitioning3() title = "ReductionBySpacePartitioning 3" elif mode == 4: rps = CNN() title = "CNN" elif mode == 5: rps = ENN() title = "ENN" elif mode == 6: rps = RENN() title = "RENN" elif mode == 7: rps = SGP() title = "SGP" else: rps = TomekLinks() title = "Tomek Links" r = rps.fit(X_orig, y_orig)