def getModel(self): self.warning(0) self.error(0) self.statInfo = "" self.statistics = None self.statInfoBox.setText("") """Get the model and send it to the output""" if not os.path.isdir(str(self.statPath)): statPath = None modelPath = None else: statPath = os.path.join(str(self.statPath), "statistics.pkl") modelPath = os.path.join(str(self.statPath), "Model") res = competitiveWorkflow.competitiveWorkflow( self.dataset, modelSavePath=modelPath, statisticsSavePath=statPath, runningDir=AZOC.NFS_SCRATCHDIR, queueType=self.queueTypes[self.queueType], callBack=self.advance, ) if not res: self.error("Errors occurred. Please check the output window.") self.send("Classifier", None) self.send("Examples", None) return self.classifier = res["model"][res["model"].keys()[0]] statistics = res["statistics"] # DEBUG # fileh = open("/home/palmeida/dev/AZOrange/orange/OrangeWidgets/Classify/model.pkl") # statistics = pickle.load(fileh) # fileh.close() # self.classifier = AZBaseClasses.modelRead("/home/palmeida/dev/AZOrange/orange/OrangeWidgets/Classify/Model") if not statistics: self.statInfo = "Some error occured. Could not get statistics.\nPlease check the output window" else: self.statistics = self.createStatData(statistics) if statPath and os.path.isfile(statPath): self.statInfo = ( "Statistics were saved to " + statPath + "\n" + "You can save the statistics in other place by using \n" ) else: self.statInfo += "You can save the statistics by using \n" self.statInfo += ( " the button 'Save statistics'\n\n" + "You can also use or view the statistics by connecting \n" + " the appropriate widget to this widget output" ) self.statInfoBox.setText(self.statInfo) self.classifier.name = str(self.name) self.send("Classifier", self.classifier) self.send("Examples", self.statistics)
def testReg_Serial(self): """Test regression in serial mode """ res = competitiveWorkflow.competitiveWorkflow(self.Ctrain_data) print "Results : ",res self.assert_("statistics" in res) self.assert_("model" in res) self.assert_("selectedML" in res["statistics"]) self.assert_(res["model"][res["model"].keys()[0]] is not None) self.assertEqual(res["statistics"]["selectedML"]["responseType"], "Regression") self.assert_(res["statistics"]["selectedML"]["Q2"] > 0 )
def no_testClass_SGE(self): """Test classification in serial mode """ res = competitiveWorkflow.competitiveWorkflow(self.Dtrain_data, queueType = "batch.q") print "Results : ",res self.assert_("statistics" in res) self.assert_("model" in res) self.assert_("selectedML" in res["statistics"]) self.assert_(res["model"][res["model"].keys()[0]] is not None) self.assertEqual(res["statistics"]["selectedML"]["responseType"], "Classification") self.assert_(res["statistics"]["selectedML"]["CA"] > 0 )
def disabled_testReg_SGE(self): """Test regression in serial mode """ res = competitiveWorkflow.competitiveWorkflow(self.Ctrain_data, queueType="batch.q") print "Results : ", res self.assert_("statistics" in res) self.assert_("model" in res) self.assert_("selectedML" in res["statistics"]) self.assert_(res["model"][res["model"].keys()[0]] is not None) self.assertEqual(res["statistics"]["selectedML"]["responseType"], "Regression") self.assert_(res["statistics"]["selectedML"]["Q2"] > 0)
def getModel(self): self.warning(0) self.error(0) self.statInfo = "" self.statistics = None self.statInfoBox.setText("") """Get the model and send it to the output""" if not os.path.isdir(str(self.statPath)): statPath = None modelPath = None else: statPath = os.path.join(str(self.statPath), "statistics.pkl") modelPath = os.path.join(str(self.statPath), "Model") res = competitiveWorkflow.competitiveWorkflow( self.dataset, modelSavePath=modelPath, statisticsSavePath=statPath, runningDir=AZOC.NFS_SCRATCHDIR, queueType=self.queueTypes[self.queueType], callBack=self.advance) if not res: self.error("Errors occurred. Please check the output window.") self.send("Classifier", None) self.send("Examples", None) return self.classifier = res["model"][res["model"].keys()[0]] statistics = res["statistics"] # DEBUG #fileh = open("/home/palmeida/dev/AZOrange/orange/OrangeWidgets/Classify/model.pkl") #statistics = pickle.load(fileh) #fileh.close() #self.classifier = AZBaseClasses.modelRead("/home/palmeida/dev/AZOrange/orange/OrangeWidgets/Classify/Model") if not statistics: self.statInfo = "Some error occured. Could not get statistics.\nPlease check the output window" else: self.statistics = self.createStatData(statistics) if statPath and os.path.isfile(statPath): self.statInfo = "Statistics were saved to " + statPath+"\n"+\ "You can save the statistics in other place by using \n" else: self.statInfo += "You can save the statistics by using \n" self.statInfo += " the button 'Save statistics'\n\n"+\ "You can also use or view the statistics by connecting \n"+\ " the appropriate widget to this widget output" self.statInfoBox.setText(self.statInfo) self.classifier.name = str(self.name) self.send("Classifier", self.classifier) self.send("Examples", self.statistics)