def init_workflow(self): # === Create the AccumulatedObjects. === self.frame.add_accumulated_value("lossTest", 10) self.frame.AV["loss"].avgWidth = 10 # ======= AVP. ====== # === Create a AccumulatedValuePlotter object for ploting. === if (True == self.flagUseIntPlotter): self.frame.AVP.append(\ WorkFlow.PLTIntermittentPlotter(\ self.frame.workingDir + "/IntPlot", "loss", self.frame.AV, ["loss"], [True], semiLog=True) ) self.frame.AVP.append(\ WorkFlow.PLTIntermittentPlotter(\ self.frame.workingDir + "/IntPlot", "lossTest", self.frame.AV, ["lossTest"], [True], semiLog=True) ) else: self.frame.AVP.append(\ WorkFlow.VisdomLinePlotter(\ "loss", self.frame.AV, ["loss"], [True], semiLog=True) ) self.frame.AVP.append(\ WorkFlow.VisdomLinePlotter(\ "lossTest", self.frame.AV, ["lossTest"], [True], semiLog=True) )
def register_info_plotter(self, name, infoNames, avgFlags, subDir='IntPlot', flagSemiLog=False): if ( self.flagUseIntPlotter ): self.frame.AVP.append(\ WorkFlow.PLTIntermittentPlotter(\ os.path.join(self.frame.workingDir, subDir), name, self.frame.AV, infoNames, avgFlags, semiLog=flagSemiLog) ) else: self.frame.AVP.append(\ WorkFlow.VisdomLinePlotter(\ name, self.frame.AV, infoNames, avgFlags, semiLog=flagSemiLog) )
def __init__(self, workingDir, prefix = "", suffix = ""): super(MyWF, self).__init__(workingDir, prefix, suffix) # === Custom member variables. === logstr = '' for param in LogParamList: # record useful params in logfile try: logstr += param + ': '+ str(globals()[param]) + ', ' except: pass self.logger.info(logstr) # === Create the AccumulatedObjects. === self.add_accumulated_value("loss2", 10) self.add_accumulated_value("lossLeap") self.add_accumulated_value("testAvg1", 10) self.add_accumulated_value("testAvg2", 20) self.add_accumulated_value("lossTest") # This should raise an exception. # self.add_accumulated_value("loss") # === Create a AccumulatedValuePlotter object for ploting. === plotDir = self.workingDir + "/IntermittentPlots" avNameList = ["loss", "loss2", "lossLeap"] avAvgFlagList = [ True, False, True ] self.AVP.append(\ WorkFlow.PLTIntermittentPlotter(\ plotDir, "Combined", self.AV, avNameList, avAvgFlagList)\ ) self.AVP.append(\ WorkFlow.PLTIntermittentPlotter(\ plotDir, "loss", self.AV, ["loss"])\ ) self.AVP.append(\ WorkFlow.PLTIntermittentPlotter(\ plotDir, "losse", self.AV, ["loss2"], [True])\ ) self.AVP.append(\ WorkFlow.PLTIntermittentPlotter(\ plotDir, "lossLeap", self.AV, ["lossLeap"], [True])\ ) self.AVP[-1].title = "Loss Leap" self.AVP.append(\ WorkFlow.PLTIntermittentPlotter(\ plotDir, "testAvg1", self.AV, ["testAvg1"], [True])\ ) self.AVP.append(\ WorkFlow.PLTIntermittentPlotter(\ plotDir, "testAvg2", self.AV, ["testAvg2"], [True], semiLog=True)\ ) # === Custom member variables. === self.countTrain = 0 self.countTest = 0
def append_plotter(self, plotName, valueNameList, smoothList, semiLog=False): if self.plotterType == 'Visdom': self.AVP.append(WorkFlow.VisdomLinePlotter(plotName, self.AV, valueNameList, smoothList, semiLog=semiLog)) elif self.plotterType == 'Int': self.AVP.append(WorkFlow.PLTIntermittentPlotter(self.workingDir + "/IntPlot", plotName, self.AV, valueNameList, smoothList, semiLog=semiLog))