def trainTest(self,testSplit,**kw): idLab = self.idLab spDir = self.getSplitDirName(testSplit) makedir(spDir) idLabRec = idLab.getRecords() spIdLab = idLabRec.copy() spIdLab["split"] = 1 spIdLab["split"][idLabRec["split"]==testSplit] = 2 spIdLabFile = pjoin(spDir,"idlab.pkl") saveIdLabelRecords(records=spIdLab,fileName=spIdLabFile) spClOpt = copy(self.clOpt) spClOpt.labels = [spIdLabFile] spClOpt.predFile = pjoin(spDir,"pred.pkl") spClOpt.perfFile = pjoin(spDir,"perf.pkl") spClOpt.mode = "trainScatter" spClOpt.runMode = self.opt.runMode spClOpt.cwd = spDir spOptFile = self.getSplitOptFileName(testSplit) spApp = ClassifierApp(opt=spClOpt) spClOpt = spApp.getOpt() #get the missing options filled with defaults #that just saves a copy for us - App will create its own when it #submits a batch job (unique and slightly modified) dumpObj(spClOpt,spOptFile) kw = kw.copy() jobs = spApp.run(**kw) spClOpt.mode = "test" spApp = ClassifierApp(opt=spClOpt) kw["depend"] = jobs jobs = spApp.run(**kw) return jobs
def run(self, **kw): from MGT.ClassifierApp import ClassifierApp opt = self.opt opt.cwd = self.path # in case we moved it after __init__() jobs = [] opt.mode = "trainScatter" app = ClassifierApp(opt=opt) opt = app.getOpt() # get the missing options filled with defaults # we need to clean up the models directory otherwise we run a danger # of picking up old models that are not trained in this session rmrf(self.getFilePath(opt.modelRoot)) return app.run(**kw)
def run(self, **kw): from MGT.ClassifierApp import ClassifierApp opt = self.opt opt.cwd = self.path # in case we moved it after __init__() opt.predFile = pjoin(opt.cwd, "pred.pkl") jobs = [] opt.mode = "predict" app = ClassifierApp(opt=opt) opt = app.getOpt() # get the missing options filled with defaults jobs = app.run(**kw) self.save() return jobs
def run(self, **kw): from MGT.ClassifierApp import ClassifierApp opt = self.opt opt.cwd = self.path # in case we moved it after __init__() opt.predFile = pjoin(opt.cwd, "pred.pkl") opt.perfFile = pjoin(opt.cwd, "perf.pkl") jobs = [] opt.mode = "trainScatter" app = ClassifierApp(opt=opt) opt = app.getOpt() # get the missing options filled with defaults # we need to clean up the models directory otherwise we run a danger # of picking up old models that are not trained in this session rmrf(self.getFilePath(opt.modelRoot)) jobs = app.run(**kw) opt.mode = "test" app = ClassifierApp(opt=opt) opt = app.getOpt() # get the missing options filled with defaults self.save() kw = kw.copy() kw["depend"] = jobs jobs = app.run(**kw) return jobs