def getStatistics(self): self.warning(0) self.error(0) self.statInfo = "" self.statistics = None self.statInfoBox.setText("") """Get the statistics and save to desired place if specifyes""" if not os.path.isdir(str(self.statPath)): statPath = None else: statPath = os.path.join(str(self.statPath), "statistics.pkl") runPath = miscUtilities.createScratchDir(desc="CombiQSAR", baseDir=AZOC.NFS_SCRATCHDIR) # DEBUG #fileh = open("/home/palmeida/dev/AZOrange/orange/OrangeWidgets/Classify/stat.pkl") #statistics = pickle.load(fileh) #fileh.close() print "OptimizeChBox", self.OptimizeChBox mlList = [] for row in range(self.mlTable.rowCount()): if self.mlTable.cellWidget(row, 1).checkState() == 2: mlList.append(str(self.mlTable.item(row, 0).text()).strip()) statistics = competitiveWorkflow.getMLStatistics( self.dataset, mlList=mlList, savePath=statPath, queueType=self.queueTypes[self.queueType], verbose=0, logFile=None, callBack=self.advance) #select the best model MLMethod = competitiveWorkflow.selectModel(statistics, logFile=None) self.classifier = competitiveWorkflow.buildModel( self.dataset, MLMethod, queueType=self.queueTypes[self.queueType], verbose=0, logFile=None) if not self.classifier: self.statInfo = "Could not get a classifier. Please check the output window." if not statistics: self.statInfo = "Some error occured. Please 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 getStatistics(self): self.warning(0) self.error(0) self.statInfo = "" self.statistics = None self.statInfoBox.setText("") """Get the statistics and save to desired place if specifyes""" if not os.path.isdir(str(self.statPath)): statPath = None else: statPath = os.path.join(str(self.statPath), "statistics.pkl") runPath = miscUtilities.createScratchDir(desc="CombiQSAR", baseDir=AZOC.NFS_SCRATCHDIR) # DEBUG # fileh = open("/home/palmeida/dev/AZOrange/orange/OrangeWidgets/Classify/stat.pkl") # statistics = pickle.load(fileh) # fileh.close() print "OptimizeChBox", self.OptimizeChBox mlList = [] for row in range(self.mlTable.rowCount()): if self.mlTable.cellWidget(row, 1).checkState() == 2: mlList.append(str(self.mlTable.item(row, 0).text()).strip()) statistics = competitiveWorkflow.getMLStatistics( self.dataset, mlList=mlList, savePath=statPath, queueType=self.queueTypes[self.queueType], verbose=0, logFile=None, callBack=self.advance, ) # select the best model MLMethod = competitiveWorkflow.selectModel(statistics, logFile=None) self.classifier = competitiveWorkflow.buildModel( self.dataset, MLMethod, queueType=self.queueTypes[self.queueType], verbose=0, logFile=None ) if not self.classifier: self.statInfo = "Could not get a classifier. Please check the output window." if not statistics: self.statInfo = "Some error occured. Please 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)