def add_submodel(self): submodel_hlayout = QtGui.QHBoxLayout() font = QtGui.QFont() font.setPointSize(10) submodel_hlayout.setMargin(11) submodel_hlayout.setSpacing(6) submodel_hlayout.setObjectName(_fromUtf8("submodel_hlayout")) modelchoices = self.pysat_fun.modelkeys if modelchoices == []: error_print('No model has been trained') modelchoices = ['No model has been trained!'] choose_submodel = make_combobox(modelchoices) submodel_hlayout.addWidget(choose_submodel) submodel_min_label = QtGui.QLabel() submodel_min_label.setObjectName(_fromUtf8("submodel_min_label")) submodel_min_label.setFont(font) submodel_hlayout.addWidget(submodel_min_label) submodel_min = QtGui.QDoubleSpinBox() submodel_min.setObjectName(_fromUtf8("submodel_min")) submodel_min.setFont(font) submodel_min.setMaximum(1000) submodel_min.setMinimum(-1000) submodel_hlayout.addWidget(submodel_min) submodel_max_label = QtGui.QLabel() submodel_max_label.setObjectName(_fromUtf8("submodel_max_label")) submodel_max_label.setFont(font) submodel_hlayout.addWidget(submodel_max_label) submodel_max = QtGui.QDoubleSpinBox() submodel_max.setObjectName(_fromUtf8("submodel_max")) submodel_max.setFont(font) submodel_max.setMaximum(1000) submodel_max.setMinimum(-1000) submodel_hlayout.addWidget(submodel_max) spacerItem2 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) submodel_hlayout.addItem(spacerItem2) submodel_min_label.setText(_translate("MainWindow", "Min: ", None)) submodel_max_label.setText(_translate("MainWindow", "Max: ", None)) self.midmodel_vlayout.addLayout(submodel_hlayout) # insert the new submodel objects into the list self.submodel_gui_info.insert(-1, [choose_submodel, [submodel_min, submodel_max]]) # connect dropdown so spinbox ranges are updated choose_submodel.currentIndexChanged.connect( lambda: self.set_ranges(choose_submodel.currentText(), minspin=submodel_min, maxspin=submodel_max)) # connect so parameters are updated when things are changed choose_submodel.currentIndexChanged.connect(lambda: self.get_sm_params()) submodel_min.valueChanged.connect(lambda: self.get_sm_params()) submodel_max.valueChanged.connect(lambda: self.get_sm_params()) # update parameters when submodel is first added self.set_ranges(choose_submodel.currentText(), minspin=submodel_min, maxspin=submodel_max) self.get_sm_params()
def dim_reduction_ui(self): self.dim_reduction = QtGui.QGroupBox() font = QtGui.QFont() font.setPointSize(10) self.dim_reduction.setFont(font) self.dim_reduction.setObjectName(_fromUtf8("Dimensionality Reduction")) self.dim_reduction_vlayout = QtGui.QVBoxLayout(self.dim_reduction) self.dim_reduction_vlayout.setObjectName( _fromUtf8("dim_reduction_vlayout")) #choose data set to apply dim reduction to self.dim_reduction_choose_data_label = QtGui.QLabel(self.dim_reduction) self.dim_reduction_choose_data_label.setObjectName( _fromUtf8("dim_reduction_choose_data_label")) self.dim_reduction_vlayout.addWidget( self.dim_reduction_choose_data_label) datachoices = self.pysat_fun.datakeys if datachoices == []: error_print('No data has been loaded!') datachoices = ['No data has been loaded!'] self.dim_reduction_choose_data = make_combobox(datachoices) self.dim_reduction_vlayout.addWidget(self.dim_reduction_choose_data) #Choose the algorithm to apply self.dim_red_choosealg_label = QtGui.QLabel(self.dim_reduction) self.dim_reduction_vlayout.addWidget(self.dim_red_choosealg_label) alg_choices = ['Choose a method', 'PCA', 'ICA', 'ICA-JADE'] self.dim_red_choosealg = make_combobox(alg_choices) self.dim_reduction_vlayout.addWidget(self.dim_red_choosealg) self.module_layout.addWidget(self.dim_reduction) self.dim_reduction.raise_() self.dim_reduction.setTitle( _translate("MainWindow", "Dimensionality Reduction", None)) self.dim_reduction_choose_data_label.setText( _translate("dim_reduction", "Choose data:", None)) self.dim_red_choosealg_label.setText( _translate("dim_reduction", "Choose method:", None)) self.dim_reduction_choose_data.currentIndexChanged.connect( lambda: self.get_dim_red_params()) self.dim_red_choosealg.currentIndexChanged.connect( lambda: self.get_dim_red_params())
def get_mask_ui(self): self.get_mask = QtGui.QGroupBox() font = QtGui.QFont() font.setPointSize(10) self.get_mask.setFont(font) self.get_mask.setObjectName(_fromUtf8("get_mask")) self.horizontalLayout = QtGui.QHBoxLayout(self.get_mask) self.horizontalLayout.setMargin(11) self.horizontalLayout.setSpacing(6) self.horizontalLayout.setObjectName(_fromUtf8("horizontalLayout")) self.choosedata_label = QtGui.QLabel(self.get_mask) self.choosedata_label.setObjectName(_fromUtf8("choosedata_label")) self.horizontalLayout.addWidget(self.choosedata_label) datachoices = self.pysat_fun.datakeys if datachoices == []: error_print('No data has been loaded!') datachoices = ['No data has been loaded!'] self.mask_choosedata = make_combobox(datachoices) self.horizontalLayout.addWidget(self.mask_choosedata) self.get_mask_label = QtGui.QLabel(self.get_mask) self.get_mask_label.setObjectName(_fromUtf8("get_mask_label")) self.horizontalLayout.addWidget(self.get_mask_label) self.get_mask_line_edit = QtGui.QLineEdit(self.get_mask) self.get_mask_line_edit.setReadOnly(True) self.get_mask_line_edit.setObjectName(_fromUtf8("get_mask_line_edit")) self.horizontalLayout.addWidget(self.get_mask_line_edit) self.get_mask_button = QtGui.QToolButton(self.get_mask) self.get_mask_button.setObjectName(_fromUtf8("get_mask_button")) self.horizontalLayout.addWidget(self.get_mask_button) self.module_layout.addWidget(self.get_mask) self.get_mask.setTitle(_translate("MainWindow", "Mask Data", None)) self.choosedata_label.setText( _translate("MainWindow", "Choose data: ", None)) self.get_mask_label.setText( _translate("MainWindow", "Mask file: ", None)) self.get_mask_line_edit.setText(_translate("MainWindow", "*.csv", None)) self.get_mask_button.setText(_translate("MainWindow", "...", None)) self.get_mask_line_edit.textChanged.connect( lambda: self.get_mask_params()) self.mask_choosedata.currentIndexChanged.connect( lambda: self.get_mask_params()) self.get_mask_button.clicked.connect( lambda: self.on_getDataButton_clicked(self.get_mask_line_edit)) self.set_mask_params()
def optimize_ranges(self, ischecked, datachoices): if not ischecked: self.choosedata_label.deleteLater() self.choosedata.deleteLater() else: font = QtGui.QFont() font.setPointSize(10) self.choosedata_label = QtGui.QLabel(self.submodel_predict) self.choosedata_label.setObjectName(_fromUtf8("choosedata_label")) self.choosedata_label.setText( _translate("MainWindow", "Choose known data to optimize submodel ranges:", None)) self.choosedata_label.setFont(font) self.choosedata_hlayout.addWidget(self.choosedata_label) self.choosedata = make_combobox(datachoices) self.choosedata_hlayout.addWidget(self.choosedata) self.choosedata.currentIndexChanged.connect(lambda: self.get_sm_params()) self.get_sm_params()
def write_data_ui(self): self.write_data = QtGui.QGroupBox() font = QtGui.QFont() font.setPointSize(10) self.write_data.setFont(font) self.write_data_vlayout = QtGui.QVBoxLayout(self.write_data) self.write_data_choose_data_label = QtGui.QLabel(self.write_data) self.write_data_choose_data_label.setText( _translate("write_data", "Choose data set to write to .csv:", None)) self.write_data_vlayout.addWidget(self.write_data_choose_data_label) datachoices = self.pysat_fun.datakeys if datachoices == []: error_print('No data has been loaded!') datachoices = ['No data has been loaded!'] self.write_data_choose_data = make_combobox(datachoices) self.write_data_vlayout.addWidget(self.write_data_choose_data) self.write_data_linedit_label = QtGui.QLabel(self.write_data) self.write_data_linedit_label.setText('Specify a filename:') self.write_data_vlayout.addWidget(self.write_data_linedit_label) self.write_data_file = QtGui.QLineEdit(self.write_data) self.write_data_file.setText('output.csv') self.write_data_vlayout.addWidget(self.write_data_file) self.module_layout.addWidget(self.write_data) self.write_data.raise_() self.write_data.setTitle(_translate("MainWindow", "Write to CSV", None)) self.write_data_choose_data.currentIndexChanged.connect( lambda: self.get_write_params()) self.write_data_file.textChanged.connect( lambda: self.get_write_params()) self.get_write_params()
def removenull_ui(self): self.removenull = QtGui.QGroupBox() font = QtGui.QFont() font.setPointSize(10) self.removenull.setFont(font) self.removenull.setObjectName(_fromUtf8("removenull")) self.verticalLayout = QtGui.QVBoxLayout(self.removenull) self.verticalLayout.setMargin(11) self.verticalLayout.setSpacing(6) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) self.removenull_vlayout = QtGui.QVBoxLayout() self.removenull_vlayout.setMargin(11) self.removenull_vlayout.setSpacing(6) self.removenull_vlayout.setObjectName(_fromUtf8("removenull_vlayout")) self.removenull_choosedata_hlayout = QtGui.QHBoxLayout() self.removenull_choosedata_hlayout.setMargin(11) self.removenull_choosedata_hlayout.setSpacing(6) self.removenull_choosedata_hlayout.setObjectName( _fromUtf8("removenull_choosedata_hlayout")) self.removenull_choosedata_label = QtGui.QLabel(self.removenull) self.removenull_choosedata_label.setObjectName( _fromUtf8("removenull_choosedata_label")) self.removenull_choosedata_hlayout.addWidget( self.removenull_choosedata_label) datachoices = self.pysat_fun.datakeys if datachoices == []: error_print('No data has been loaded!') datachoices = ['No data has been loaded!'] self.removenull_choosedata = make_combobox(datachoices) self.removenull_choosedata_hlayout.addWidget( self.removenull_choosedata) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.removenull_choosedata_hlayout.addItem(spacerItem) self.removenull_vlayout.addLayout(self.removenull_choosedata_hlayout) self.removenull_widget = QtGui.QWidget(self.removenull) self.removenull_widget.setMinimumSize(QtCore.QSize(0, 0)) self.removenull_widget.setObjectName(_fromUtf8("removenull_widget")) self.horizontalLayout_2 = QtGui.QHBoxLayout(self.removenull_widget) self.horizontalLayout_2.setMargin(11) self.horizontalLayout_2.setSpacing(6) self.horizontalLayout_2.setObjectName(_fromUtf8("horizontalLayout_2")) self.start_of_sentence = QtGui.QLabel(self.removenull_widget) self.start_of_sentence.setObjectName(_fromUtf8("start_of_sentence")) self.horizontalLayout_2.addWidget(self.start_of_sentence) try: self.vars_level0 = self.pysat_fun.data[ self.removenull_choosedata.currentText( )].df.columns.get_level_values(0) self.vars_level1 = self.pysat_fun.data[ self.removenull_choosedata.currentText( )].df.columns.get_level_values(1) self.vars_level1 = list( self.vars_level1[self.vars_level0 != 'wvl']) self.vars_level0 = list( self.vars_level0[self.vars_level0 != 'wvl']) colnamechoices = self.vars_level1 except: colnamechoices = self.pysat_fun.data[ self.removenull_choosedata.currentText()].columns.values colnamechoices = [i for i in colnamechoices if not 'Unnamed' in i ] # remove unnamed columns from choices self.colname_choices = make_combobox(colnamechoices) self.horizontalLayout_2.addWidget(self.colname_choices) self.end_of_sentence = QtGui.QLabel(self.removenull_widget) self.end_of_sentence.setObjectName(_fromUtf8("end_of_sentence")) self.horizontalLayout_2.addWidget(self.end_of_sentence) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem1) self.removenull_vlayout.addWidget(self.removenull_widget) self.verticalLayout.addLayout(self.removenull_vlayout) self.module_layout.addWidget(self.removenull) self.removenull.setTitle(_translate("MainWindow", "Remove Null", None)) self.removenull_choosedata_label.setText( _translate("MainWindow", "Choose data: ", None)) self.start_of_sentence.setText( _translate("MainWindow", "Remove rows where ", None)) self.end_of_sentence.setText(_translate("MainWindow", "is null.", None)) self.get_removenull_parameters() self.colname_choices.currentIndexChanged.connect( lambda: self.get_removenull_parameters()) self.removenull_choosedata.currentIndexChanged.connect( lambda: self.get_removenull_parameters())
def stratified_folds_ui(self): self.strat_folds = QtGui.QGroupBox() font = QtGui.QFont() font.setPointSize(10) self.strat_folds.setFont(font) self.strat_folds.setObjectName(_fromUtf8("Stratified Folds")) self.strat_folds_vlayout = QtGui.QVBoxLayout(self.strat_folds) self.strat_folds_vlayout.setObjectName( _fromUtf8("strat_folds_vlayout")) self.strat_folds_choose_data_label = QtGui.QLabel(self.strat_folds) self.strat_folds_choose_data_label.setObjectName( _fromUtf8("strat_folds_choose_data_label")) self.strat_folds_vlayout.addWidget(self.strat_folds_choose_data_label) datachoices = self.pysat_fun.datakeys if datachoices == []: error_print('No data has been loaded!') datachoices = ['No data has been loaded!'] self.strat_folds_choose_data = make_combobox(datachoices) self.strat_folds_vlayout.addWidget(self.strat_folds_choose_data) self.strat_folds_choose_var_label = QtGui.QLabel(self.strat_folds) self.strat_folds_choose_var_label.setObjectName( _fromUtf8("strat_folds_choose_var_label")) self.strat_folds_vlayout.addWidget(self.strat_folds_choose_var_label) varchoices = self.pysat_fun.data[ self.strat_folds_choose_data.currentText( )].df['comp'].columns.values self.strat_folds_choose_var = make_combobox(varchoices) self.strat_folds_vlayout.addWidget(self.strat_folds_choose_var) self.strat_folds_choose_data.activated[int].connect( self.strat_fold_change_vars) self.strat_folds_hlayout = QtGui.QHBoxLayout() self.strat_folds_hlayout.setObjectName( _fromUtf8("strat_folds_hlayout")) self.nfolds_label = QtGui.QLabel(self.strat_folds) self.nfolds_label.setObjectName(_fromUtf8("nfolds_label")) self.strat_folds_hlayout.addWidget(self.nfolds_label) self.nfolds_spin = QtGui.QSpinBox(self.strat_folds) self.nfolds_spin.setObjectName(_fromUtf8("nfolds_spin")) self.nfolds_spin.setMinimum(1) self.strat_folds_hlayout.addWidget(self.nfolds_spin) self.test_fold_label = QtGui.QLabel(self.strat_folds) self.test_fold_label.setObjectName(_fromUtf8("test_fold_label")) self.strat_folds_hlayout.addWidget(self.test_fold_label) self.test_fold_label = QtGui.QLabel(self.strat_folds) self.test_fold_label.setObjectName(_fromUtf8("test_fold_label")) self.strat_folds_hlayout.addWidget(self.test_fold_label) foldchoices = ['1'] self.choose_test_fold = make_combobox(foldchoices) self.choose_test_fold.setObjectName(_fromUtf8("choose_test_fold")) self.nfolds_spin.valueChanged.connect(self.strat_fold_change_testfolds) self.strat_folds_hlayout.addWidget(self.choose_test_fold) self.spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.strat_folds_hlayout.addItem(self.spacerItem) # self.create_folds = QtGui.QPushButton(self.strat_folds) # self.create_folds.setObjectName(_fromUtf8("create_folds")) # self.create_folds.setText(_translate("strat_folds", "Create Folds", None)) # self.strat_folds_hlayout.addWidget(self.create_folds) self.strat_folds_vlayout.addLayout(self.strat_folds_hlayout) self.module_layout.addWidget(self.strat_folds) self.strat_folds.raise_() self.strat_folds.setTitle( _translate("MainWindow", "Stratified Folds", None)) self.nfolds_label.setText(_translate("strat_folds", "N folds", None)) self.test_fold_label.setText( _translate("strat_folds", "Test Fold", None)) # self.create_folds.setText(_translate("strat_folds", "Create Folds", None)) self.strat_folds_choose_data_label.setText( _translate("strat_folds", "Choose data to stratify:", None)) self.strat_folds_choose_var_label.setText( _translate("strat_folds", "Choose variable on which to sort:", None)) self.choose_test_fold.currentIndexChanged.connect( lambda: self.get_strat_fold_params()) self.nfolds_spin.valueChanged.connect( lambda: self.get_strat_fold_params()) self.strat_folds_choose_data.currentIndexChanged.connect( lambda: self.get_strat_fold_params())
def sm_ui(self): self.submodel_predict = QtGui.QGroupBox() font = QtGui.QFont() font.setPointSize(10) self.submodel_predict.setFont(font) self.submodel_predict.setObjectName(_fromUtf8("submodel_predict")) self.verticalLayout = QtGui.QVBoxLayout(self.submodel_predict) self.verticalLayout.setMargin(11) self.verticalLayout.setSpacing(6) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) # choose reference/full model self.choosemodel_hlayout = QtGui.QHBoxLayout() self.choosemodel_hlayout.setMargin(11) self.choosemodel_hlayout.setSpacing(6) self.choosemodel_hlayout.setObjectName(_fromUtf8("choosemodel_hlayout")) self.choosemodel_label = QtGui.QLabel(self.submodel_predict) self.choosemodel_label.setObjectName(_fromUtf8("choosemodel_label")) self.choosemodel_hlayout.addWidget(self.choosemodel_label) modelchoices = self.pysat_fun.modelkeys if modelchoices == []: error_print('No model has been trained') modelchoices = ['No model has been trained!'] self.choosemodel = make_combobox(modelchoices) self.choosemodel_hlayout.addWidget(self.choosemodel) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.choosemodel_hlayout.addItem(spacerItem) self.verticalLayout.addLayout(self.choosemodel_hlayout) # organize submodels vertically self.submodels_vlayout = QtGui.QVBoxLayout() self.submodels_vlayout.setMargin(11) self.submodels_vlayout.setSpacing(6) self.submodels_vlayout.setObjectName(_fromUtf8("submodels_vlayout")) # always have a low submodel self.low_model_hlayout = QtGui.QHBoxLayout() self.low_model_hlayout.setMargin(11) self.low_model_hlayout.setSpacing(6) self.low_model_hlayout.setObjectName(_fromUtf8("low_model_hlayout")) self.low_model_label = QtGui.QLabel(self.submodel_predict) self.low_model_label.setText('Low Model:') self.low_model_hlayout.addWidget(self.low_model_label) self.choose_low_model = make_combobox(modelchoices) self.low_model_hlayout.addWidget(self.choose_low_model) self.low_model_max_label = QtGui.QLabel(self.submodel_predict) self.low_model_max_label.setObjectName(_fromUtf8("low_model_max_label")) self.low_model_hlayout.addWidget(self.low_model_max_label) self.low_model_max = QtGui.QDoubleSpinBox(self.submodel_predict) self.low_model_max.setObjectName(_fromUtf8("low_model_max")) self.low_model_max.setMaximum(1000) self.low_model_max.setMinimum(-1000) self.low_model_hlayout.addWidget(self.low_model_max) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.low_model_hlayout.addItem(spacerItem1) self.submodels_vlayout.addLayout(self.low_model_hlayout) # middle submodels go here self.midmodel_vlayout = QtGui.QVBoxLayout() self.submodels_vlayout.addLayout(self.midmodel_vlayout) # always have a high submodel self.high_model_hlayout = QtGui.QHBoxLayout() self.high_model_hlayout.setMargin(11) self.high_model_hlayout.setSpacing(6) self.high_model_hlayout.setObjectName(_fromUtf8("high_model_hlayout")) self.high_model_label = QtGui.QLabel(self.submodel_predict) self.high_model_label.setText('High Model:') self.high_model_hlayout.addWidget(self.high_model_label) self.choose_high_model = make_combobox(modelchoices) self.high_model_hlayout.addWidget(self.choose_high_model) self.high_model_min_label = QtGui.QLabel(self.submodel_predict) self.high_model_min_label.setObjectName(_fromUtf8("high_model_min_label")) self.high_model_hlayout.addWidget(self.high_model_min_label) self.high_model_min = QtGui.QDoubleSpinBox(self.submodel_predict) self.high_model_min.setObjectName(_fromUtf8("high_model_min")) self.high_model_min.setMaximum(1000) self.high_model_min.setMinimum(-1000) self.high_model_hlayout.addWidget(self.high_model_min) spacerItem3 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.high_model_hlayout.addItem(spacerItem3) self.submodels_vlayout.addLayout(self.high_model_hlayout) self.verticalLayout.addLayout(self.submodels_vlayout) # set the spinbox ranges based on the models self.set_ranges(self.choose_high_model.currentText(), minspin=self.high_model_min) self.set_ranges(self.choose_low_model.currentText(), maxspin=self.low_model_max) # add or delete submodel buttons self.add_delete_hlayout = QtGui.QHBoxLayout() self.add_delete_hlayout.setMargin(11) self.add_delete_hlayout.setSpacing(6) self.add_delete_hlayout.setObjectName(_fromUtf8("add_delete_hlayout")) self.add_submodel_button = QtGui.QPushButton(self.submodel_predict) self.add_submodel_button.setObjectName(_fromUtf8("add_submodel_button")) self.add_delete_hlayout.addWidget(self.add_submodel_button) self.delete_submodel_button = QtGui.QPushButton(self.submodel_predict) self.delete_submodel_button.setObjectName(_fromUtf8("delete_submodel_button")) self.add_delete_hlayout.addWidget(self.delete_submodel_button) self.optimize_checkbox = QtGui.QCheckBox(self.submodel_predict) self.optimize_checkbox.setObjectName(_fromUtf8("optimize_checkbox")) self.add_delete_hlayout.addWidget(self.optimize_checkbox) spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.add_delete_hlayout.addItem(spacerItem4) self.verticalLayout.addLayout(self.add_delete_hlayout) datachoices = self.pysat_fun.datakeys if datachoices == []: error_print('No Data has been loaded') datachoices = ['No data has been loaded!'] # choose data to optimize blending self.choosedata_hlayout = QtGui.QHBoxLayout() self.choosedata_hlayout.setMargin(11) self.choosedata_hlayout.setSpacing(6) self.choosedata_hlayout.setObjectName(_fromUtf8("choosedata_hlayout")) self.verticalLayout.addLayout(self.choosedata_hlayout) # choose data to predict self.predictdata_vlayout = QtGui.QVBoxLayout() self.predictdata_vlayout.setMargin(11) self.predictdata_vlayout.setSpacing(6) self.predictdata_vlayout.setObjectName(_fromUtf8("predictdata_vlayout")) self.choosedata_predict_label = QtGui.QLabel(self.submodel_predict) self.choosedata_predict_label.setObjectName(_fromUtf8("choosedata_predict_label")) self.predictdata_vlayout.addWidget(self.choosedata_predict_label) self.choosedata_predict = make_combobox(datachoices) self.predictdata_vlayout.addWidget(self.choosedata_predict) spacerItem6 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.predictdata_vlayout.addItem(spacerItem6) self.verticalLayout.addLayout(self.predictdata_vlayout) self.module_layout.addWidget(self.submodel_predict) # put submodel objects in a list self.submodel_gui_info = [[self.choose_low_model, [-9999, self.low_model_max]], [self.choose_high_model, [self.high_model_min, 9999]], [self.choosemodel, [-9999, 9999]]] self.submodel_predict.setTitle(_translate("MainWindow", "Submodel - Predict", None)) self.choosemodel_label.setText(_translate("MainWindow", "Choose reference model:", None)) self.low_model_max_label.setText(_translate("MainWindow", "Max:", None)) self.high_model_min_label.setText(_translate("MainWindow", "Min: ", None)) self.add_submodel_button.setText(_translate("MainWindow", "Add Submodel", None)) self.delete_submodel_button.setText(_translate("MainWindow", "Delete Submodel", None)) self.optimize_checkbox.setText(_translate("MainWindow", "Optimize", None)) self.choosedata_predict_label.setText(_translate("MainWindow", "Choose data to predict:", None)) # connect the add and delete submodel buttons and opt checkbox self.add_submodel_button.clicked.connect(lambda: self.add_submodel()) self.delete_submodel_button.clicked.connect(lambda: self.del_submodel()) self.optimize_checkbox.toggled.connect( lambda: self.optimize_ranges(self.optimize_checkbox.isChecked(), datachoices)) # connect the low and high models so spinbox ranges are updated self.choose_low_model.currentIndexChanged.connect( lambda: self.set_ranges(self.choose_low_model.currentText(), maxspin=self.low_model_max)) self.choose_high_model.currentIndexChanged.connect( lambda: self.set_ranges(self.choose_high_model.currentText(), minspin=self.high_model_min)) # connect everything so that parameters get updated when changed self.choosemodel.currentIndexChanged.connect(lambda: self.get_sm_params()) self.high_model_min.valueChanged.connect(lambda: self.get_sm_params()) self.low_model_max.valueChanged.connect(lambda: self.get_sm_params()) self.choose_low_model.currentIndexChanged.connect(lambda: self.get_sm_params()) self.choose_high_model.currentIndexChanged.connect(lambda: self.get_sm_params()) self.get_sm_params() # get initial parameters
def interpolation_ui(self): # TODO have the comboboxes called datachoices = self.pysat_fun.datakeys if datachoices == []: error_print('No Data has been loaded') datachoices = ['No data has been loaded!'] self.Interpolation = QtGui.QGroupBox() font = QtGui.QFont() font.setPointSize(10) self.Interpolation.setFont(font) self.Interpolation.setObjectName("Interpolation") self.verticalLayout = QtGui.QVBoxLayout(self.Interpolation) self.verticalLayout.setMargin(11) self.verticalLayout.setSpacing(6) self.verticalLayout.setObjectName("verticalLayout") self.choosedata_layout = QtGui.QHBoxLayout() self.choosedata_layout.setMargin(11) self.choosedata_layout.setSpacing(6) self.choosedata_layout.setObjectName("choosedata_layout") self.interpolation_choosedata_label = QtGui.QLabel(self.Interpolation) self.interpolation_choosedata_label.setObjectName( "interpolation_choosedata_label") self.choosedata_layout.addWidget(self.interpolation_choosedata_label) self.interpoliation_choosedata = make_combobox(datachoices) self.interpoliation_choosedata.setIconSize(QtCore.QSize(50, 20)) self.interpoliation_choosedata.setObjectName( "interpolation_choosedata") self.choosedata_layout.addWidget(self.interpoliation_choosedata) spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.choosedata_layout.addItem(spacerItem) self.verticalLayout.addLayout(self.choosedata_layout) self.choosedata_layout_2 = QtGui.QHBoxLayout() self.choosedata_layout_2.setMargin(11) self.choosedata_layout_2.setSpacing(6) self.choosedata_layout_2.setObjectName("choosedata_layout_2") self.interpolation_choosedata_label_2 = QtGui.QLabel( self.Interpolation) self.interpolation_choosedata_label_2.setObjectName( "interpolation_choosedata_label_2") self.choosedata_layout_2.addWidget( self.interpolation_choosedata_label_2) self.interpolation_choosedata_2 = make_combobox(datachoices) self.interpolation_choosedata_2.setIconSize(QtCore.QSize(50, 20)) self.interpolation_choosedata_2.setObjectName( "interpolation_choosedata_2") self.choosedata_layout_2.addWidget(self.interpolation_choosedata_2) spacerItem1 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.choosedata_layout_2.addItem(spacerItem1) self.verticalLayout.addLayout(self.choosedata_layout_2) self.module_layout.addWidget(self.Interpolation) self.Interpolation.setTitle( _translate("MainWindow", "Interpolation", None)) self.interpolation_choosedata_label.setText( _translate("MainWindow", "Choose data to interpolate: ", None)) self.interpolation_choosedata_label_2.setText( _translate("MainWindow", "Choose data to use as reference: ", None)) self.set_parameters()
def dim_red_plot_ui(self): self.dim_red_plot = QtGui.QGroupBox() font = QtGui.QFont() font.setPointSize(10) self.dim_red_plot.setFont(font) self.dim_red_plot.setObjectName( _fromUtf8("Dimensionality Reduction Plot")) self.dim_red_plot_vlayout = QtGui.QVBoxLayout(self.dim_red_plot) self.dim_red_plot_vlayout.setObjectName( _fromUtf8("dim_red_plot_vlayout")) #choose data set to apply dim reduction to self.dim_red_plot_choose_data_label = QtGui.QLabel(self.dim_red_plot) self.dim_red_plot_choose_data_label.setObjectName( _fromUtf8("dim_red_plot_choose_data_label")) self.dim_red_plot_choose_data_label.setText( _translate("dim_red_plot", "Choose data:", None)) self.dim_red_plot_vlayout.addWidget( self.dim_red_plot_choose_data_label) datachoices = self.pysat_fun.datakeys if datachoices == []: error_print('No data has been loaded!') datachoices = ['No data has been loaded!'] self.dim_red_plot_choose_data = make_combobox(datachoices) self.dim_red_plot_vlayout.addWidget(self.dim_red_plot_choose_data) #Choose the algorithm self.dim_red_choosealg_label = QtGui.QLabel(self.dim_red_plot) self.dim_red_choosealg_label.setText( _translate("dim_red_plot", "Choose method:", None)) self.dim_red_plot_vlayout.addWidget(self.dim_red_choosealg_label) alg_choices = ['Choose a method', 'PCA', 'ICA', 'ICA-JADE'] self.dim_red_choosealg = make_combobox(alg_choices) self.dim_red_plot_vlayout.addWidget(self.dim_red_choosealg) #choose the x and y variables xyvarchoices = ['Choose a method first'] self.xvar_choices_label = QtGui.QLabel(self.dim_red_plot) self.xvar_choices_label.setText('Choose X variable:') self.xvar_choices = make_combobox(xyvarchoices) self.xvar_choices.setObjectName(_fromUtf8("xvar_choices")) self.dim_red_plot_vlayout.addWidget(self.xvar_choices_label) self.dim_red_plot_vlayout.addWidget(self.xvar_choices) self.yvar_choices_label = QtGui.QLabel(self.dim_red_plot) self.yvar_choices_label.setText('Choose Y variable:') self.yvar_choices = make_combobox(xyvarchoices) self.yvar_choices.setObjectName(_fromUtf8("yvar_choices")) self.dim_red_plot_vlayout.addWidget(self.yvar_choices_label) self.dim_red_plot_vlayout.addWidget(self.yvar_choices) #choose the (optional) variable to use to color code the points self.colorchoices_label = QtGui.QLabel(self.dim_red_plot) self.colorchoices_label.setText( 'Choose variable to color code points (optional):') self.colorchoices = make_combobox(['']) self.colorchoices_change_vars(self.colorchoices) self.colorchoices.setObjectName(_fromUtf8("colorchoices")) self.dim_red_plot_vlayout.addWidget(self.colorchoices_label) self.dim_red_plot_vlayout.addWidget(self.colorchoices) #choose a filename for the plot self.file_label = QtGui.QLabel(self.dim_red_plot) self.file_label.setObjectName(_fromUtf8("file_label")) self.file_text = QtGui.QLineEdit(self.dim_red_plot) self.file_text.setObjectName(_fromUtf8("file_text")) self.dim_red_plot_vlayout.addWidget(self.file_label) self.dim_red_plot_vlayout.addWidget(self.file_text) self.module_layout.addWidget(self.dim_red_plot) self.dim_red_plot.raise_() self.dim_red_plot.setTitle( _translate("MainWindow", "Dimensionality Reduction", None)) self.dim_red_plot_choose_data.currentIndexChanged.connect( lambda: self.get_dim_red_params()) self.dim_red_choosealg.currentIndexChanged.connect( lambda: self.get_dim_red_params()) self.dim_red_choosealg.currentIndexChanged.connect( lambda: self.xychoices_change_vars(self.xvar_choices)) self.dim_red_choosealg.currentIndexChanged.connect( lambda: self.xychoices_change_vars(self.yvar_choices)) self.xvar_choices.currentIndexChanged.connect( lambda: self.get_dim_red_params()) self.yvar_choices.currentIndexChanged.connect( lambda: self.get_dim_red_params()) self.colorchoices.currentIndexChanged.connect( lambda: self.get_dim_red_params()) self.file_text.textChanged.connect(lambda: self.get_dim_red_params())
def stratified_folds_ui(self): self.strat_folds = QtGui.QGroupBox() font = QtGui.QFont() font.setPointSize(10) self.strat_folds.setFont(font) self.strat_folds.setObjectName(_fromUtf8("Stratified Folds")) self.strat_folds_vlayout = QtGui.QVBoxLayout(self.strat_folds) self.strat_folds_vlayout.setObjectName(_fromUtf8("strat_folds_vlayout")) self.strat_folds_choose_data_label = QtGui.QLabel(self.strat_folds) self.strat_folds_choose_data_label.setObjectName(_fromUtf8("strat_folds_choose_data_label")) self.strat_folds_vlayout.addWidget(self.strat_folds_choose_data_label) datachoices = self.pysat_fun.datakeys if datachoices == []: error_print('No data has been loaded!') datachoices = ['No data has been loaded!'] self.strat_folds_choose_data = make_combobox(datachoices) self.strat_folds_vlayout.addWidget(self.strat_folds_choose_data) self.strat_folds_choose_var_label = QtGui.QLabel(self.strat_folds) self.strat_folds_choose_var_label.setObjectName(_fromUtf8("strat_folds_choose_var_label")) self.strat_folds_vlayout.addWidget(self.strat_folds_choose_var_label) varchoices = self.pysat_fun.data[self.strat_folds_choose_data.currentText()].df['comp'].columns.values self.strat_folds_choose_var = make_combobox(varchoices) self.strat_folds_vlayout.addWidget(self.strat_folds_choose_var) self.strat_folds_choose_data.activated[int].connect(self.strat_fold_change_vars) self.strat_folds_hlayout = QtGui.QHBoxLayout() self.strat_folds_hlayout.setObjectName(_fromUtf8("strat_folds_hlayout")) self.nfolds_label = QtGui.QLabel(self.strat_folds) self.nfolds_label.setObjectName(_fromUtf8("nfolds_label")) self.strat_folds_hlayout.addWidget(self.nfolds_label) self.nfolds_spin = QtGui.QSpinBox(self.strat_folds) self.nfolds_spin.setObjectName(_fromUtf8("nfolds_spin")) self.nfolds_spin.setMinimum(1) self.strat_folds_hlayout.addWidget(self.nfolds_spin) self.test_fold_label = QtGui.QLabel(self.strat_folds) self.test_fold_label.setObjectName(_fromUtf8("test_fold_label")) self.strat_folds_hlayout.addWidget(self.test_fold_label) self.test_fold_label = QtGui.QLabel(self.strat_folds) self.test_fold_label.setObjectName(_fromUtf8("test_fold_label")) self.strat_folds_hlayout.addWidget(self.test_fold_label) foldchoices = ['1'] self.choose_test_fold = make_combobox(foldchoices) self.choose_test_fold.setObjectName(_fromUtf8("choose_test_fold")) self.nfolds_spin.valueChanged.connect(self.strat_fold_change_testfolds) self.strat_folds_hlayout.addWidget(self.choose_test_fold) self.spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.strat_folds_hlayout.addItem(self.spacerItem) # self.create_folds = QtGui.QPushButton(self.strat_folds) # self.create_folds.setObjectName(_fromUtf8("create_folds")) # self.create_folds.setText(_translate("strat_folds", "Create Folds", None)) # self.strat_folds_hlayout.addWidget(self.create_folds) self.strat_folds_vlayout.addLayout(self.strat_folds_hlayout) self.verticalLayout_8.addWidget(self.strat_folds) self.strat_folds.raise_() self.strat_folds.setTitle(_translate("MainWindow", "Stratified Folds", None)) self.nfolds_label.setText(_translate("strat_folds", "N folds", None)) self.test_fold_label.setText(_translate("strat_folds", "Test Fold", None)) # self.create_folds.setText(_translate("strat_folds", "Create Folds", None)) self.strat_folds_choose_data_label.setText(_translate("strat_folds", "Choose data to stratify:", None)) self.strat_folds_choose_var_label.setText(_translate("strat_folds", "Choose variable on which to sort:", None)) self.choose_test_fold.currentIndexChanged.connect(lambda: self.get_strat_fold_params()) self.nfolds_spin.valueChanged.connect(lambda: self.get_strat_fold_params()) self.strat_folds_choose_data.currentIndexChanged.connect(lambda: self.get_strat_fold_params())