def onLongitudinalClicked(self): Ui_MainWindow.DisableAnalysisButtons(self) Ui_MainWindow.predictionArea = [0, 0, 0, 0] # Bools to keep track: Ui_MainWindow.goodPredicted = False Ui_MainWindow.badPredicted = False Ui_MainWindow.goodpredictionList = [] Ui_MainWindow.badpredictionList = [] #Make a messagebox to ask how you wanna do this: msgBox = QtWidgets.QMessageBox(self) msgBox.setWindowTitle("Assurance - Longitudinal analysis") msgBox.setText( "For this supervised approach you will need to set aside files that have not been included in the main dataset which will be randomly divided into test and training sets. You need to divide those files into examples of good and bad quality. How would you like to do so?" ) msgBox.addButton(QtWidgets.QPushButton('Select from graph of IDs'), QtWidgets.QMessageBox.YesRole) msgBox.addButton( QtWidgets.QPushButton('Select from table of quality metrics'), QtWidgets.QMessageBox.YesRole) msgBox.addButton(QtWidgets.QPushButton('Cancel'), QtWidgets.QMessageBox.RejectRole) ret = msgBox.exec_() if ret == 0: # They want the graph tpep = Threads.SideThread(self.GetTrainingSetTable) tpep.signals.result.connect(self.OnParserThreadFinish) self.threadpool.start(tpep) elif ret == 1: # They want the table FileInput.BrowseWindow.GetTrainingQualityFiles(self) if FileInput.BrowseWindow.NullError: QtWidgets.QMessageBox.warning( self, "Error", "Is it possible there may be unnecessary spaces in your tsv? Two spaces next to each other will create a NaN column.Fix the file and upload it again." ) FileInput.BrowseWindow.__init__(Ui_MainWindow) FileInput.BrowseWindow.GetTrainingQualityFiles(Ui_MainWindow) if hasattr(Ui_MainWindow, "Numerictrainingmetrics"): if len(Ui_MainWindow.Numerictrainingmetrics) > 0: Ui_MainWindow.TrainingOrTestSet = QtWidgets.QTabWidget() Ui_MainWindow.TrainingOrTestSet.setStyleSheet( "margin: 2px;") Ui_MainWindow.sIndex = self.addTab( Ui_MainWindow.TrainingOrTestSet, "Setting up the training set:") RandomForest.RandomForest.createTable(self) self.setCurrentIndex(Ui_MainWindow.sIndex) Ui_MainWindow.RandomForestPerformed = True Ui_MainWindow.pdf.setEnabled(True) else: QtWidgets.QMessageBox.warning(self, "Error", "Something went wrong.") else: Ui_MainWindow.EnableAnalysisButtons(self) elif ret == 2: #Cancelled Ui_MainWindow.EnableAnalysisButtons(self)
def onBrowseClicked(self, database): FileInput.BrowseWindow.__init__(Ui_MainWindow) inputFiles = FileInput.BrowseWindow.GetInputFile(Ui_MainWindow) #Threading tbrowse = Threads.SideThread( lambda: self.ParseFiles(inputFiles, database)) tbrowse.signals.result.connect(self.ThreadingFix) self.threadpool.start(tbrowse)
def compute(self): UI_MainWindow.Ui_MainWindow.badpredictionList = [] UI_MainWindow.Ui_MainWindow.TrainingOrTestSet.badbtn.setEnabled(False) tRF = Threads.SideThread(lambda: RandomForest.RFFromTable(self)) tRF.signals.result.connect(self.RFFinished) self.threadpool.start(tRF)
def onPDFClicked(self): Ui_MainWindow.DisableAnalysisButtons(self) tPDF = Threads.SideThread( lambda: PDFWriter.OutputWriter.producePDF(self, now)) tPDF.signals.result.connect(self.PDFFinished) Ui_MainWindow.threadpool.start(tPDF)
def RandomForestSelection(self): Ui_MainWindow.TrainingOrTestSet.badbtn.setEnabled(False) tRF = Threads.SideThread( lambda: RandomForest.RandomForest.RFFromGraph(self)) tRF.signals.result.connect(self.RFFinished) Ui_MainWindow.threadpool.start(tRF)