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()
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) if (mode < 4): r.reduce_data() X, y = rps.get_prototypes() print "Algoritmo ", mode, dataset + '\treduction: %.2f' % (1.0 - float(y.shape[0])/len(y_orig)) plot_and_save(X, y, title=title, filename='images/RSP_b=30' + dataset + "Algoritmo " + str(mode) + '.png')