def main(self, mode='defect', justDeltas=False): if mode == "defect": train_DF = createTbl(self.train, isBin=False) test_DF = createTbl(self.test, isBin=False) before = rforest(train=train_DF, test=test_DF) clstr = [c for c in self.nodes(train_DF._rows)] return patches(train=self.train, test=self.test, clusters=clstr, prune=self.prune, pred=before).newTable(justDeltas=justDeltas) elif mode == "models": train_DF = createTbl(self.train, isBin=False) test_DF = createTbl(self.test, isBin=False) before = rforest(train=train_DF, test=test_DF) clstr = [c for c in self.nodes(train_DF._rows)] return patches(train=self.train, test=self.test, clusters=clstr, prune=self.prune, models=True, pred=before).newTable(justDeltas=justDeltas) elif mode == "config": train_DF = createTbl(self.train, isBin=False) test_DF = createTbl(self.test, isBin=False) before = rforest2(train=train_DF, test=test_DF) clstr = [c for c in self.nodes(train_DF._rows)] return patches(train=self.train, test=self.test, clusters=clstr, name=self.name, prune=self.prune, pred=before, config=True).newTable(justDeltas=justDeltas)
def __init__(self, train, test, clusters, prune=False, B=0.25, verbose=False, bin=False): if bin: self.train = createTbl(train, isBin=False) self.test = createTbl(test, isBin=False) else: self.train = createTbl(train, isBin=False) self.test = createTbl(test, isBin=True) self.clusters = clusters self.Prune = prune self.B = B self.mask = self.fWeight() self.write = verbose self.bin = bin if bin: self.pred = rforest2(self.train, self.test, smoteit=True, duplicate=True) else: self.pred = rforest(self.train, self.test, smoteit=True, duplicate=True)
def main(self, config=False): if not config: train_DF = createTbl(self.train, isBin=False) test_DF = createTbl(self.test, isBin=False) before = rforest(train=train_DF, test=test_DF) clstr = [c for c in self.nodes(train_DF._rows)] return patches(train=self.train, test=self.test, clusters=clstr, prune=self.prune).newTable() else: train_DF = createTbl(self.train, isBin=False) test_DF = createTbl(self.test, isBin=False) before = rforest2(train=train_DF, test=test_DF) clstr = [c for c in self.nodes(train_DF._rows)] return patches(train=self.train, test=self.test, clusters=clstr, prune=self.prune, bin=True).newTable()
def __init__( self, train, test, clusters, prune=False, B=0.25 , verbose=False, bin=False): if bin: self.train = createTbl(train, isBin=False) self.test = createTbl(test, isBin=False) else: self.train = createTbl(train, isBin=False) self.test = createTbl(test, isBin=True) self.clusters = clusters self.Prune = prune self.B = B self.mask = self.fWeight() self.write = verbose self.bin = bin if bin: self.pred = rforest2(self.train, self.test, smoteit=True, duplicate=True) else: self.pred = rforest(self.train, self.test, smoteit=True, duplicate=True)
#! /Users/rkrsn/miniconda/bin/python