def add_main_layout(self): box = gui.hBox(self.controlArea, "Regularization") gui.radioButtons(box, self, "reg_type", btnLabels=self.REGULARIZATION_TYPES, callback=self._reg_type_changed) gui.separator(box, 20, 20) self.alpha_box = box2 = gui.vBox(box, margin=10) gui.widgetLabel(box2, "Regularization strength:") self.alpha_slider = gui.hSlider( box2, self, "alpha_index", minValue=0, maxValue=len(self.alphas) - 1, callback=self._alpha_changed, createLabel=False) box3 = gui.hBox(box2) box3.layout().setAlignment(Qt.AlignCenter) self.alpha_label = gui.widgetLabel(box3, "") self._set_alpha_label() gui.separator(box2, 10, 10) box4 = gui.vBox(box2, margin=0) gui.widgetLabel(box4, "Elastic net mixing:") box5 = gui.hBox(box4) gui.widgetLabel(box5, "L1") self.l1_ratio_slider = gui.hSlider( box5, self, "l1_ratio", minValue=0.01, maxValue=1, intOnly=False, ticks=0.1, createLabel=False, step=0.01, callback=self._l1_ratio_changed) gui.widgetLabel(box5, "L2")
def __init__(self): OWWidget.__init__(self) ConcurrentWidgetMixin.__init__(self) self.data = None gui.radioButtons(self.controlArea, self, "axis", ["行", "列"], box="之间的距离", callback=self._invalidate) box = gui.widgetBox(self.controlArea, "距离度量") self.metrics_combo = gui.comboBox( box, self, "metric_idx", items=[m[0] for m in Chinese_METRICS], callback=self._metric_changed) self.normalization_check = gui.checkBox( box, self, "normalized_dist", "归一化", callback=self._invalidate, tooltip=("All dimensions are (implicitly) scaled to a common" "scale to normalize the influence across the domain."), stateWhenDisabled=False) _, metric = METRICS[self.metric_idx] self.normalization_check.setEnabled(metric.supports_normalization) gui.auto_apply(self.controlArea, self, "autocommit") self.layout().setSizeConstraint(self.layout().SetFixedSize)
def __init__(self): self.data = None box = gui.vBox(self.controlArea, 'Seasonal Adjustment') gui.spin( box, self, 'n_periods', 2, MAX_PERIODS, label='Season period:', callback=self.on_changed, tooltip='The expected length of full cycle. E.g., if you have ' 'monthly data and the apparent season repeats every ' 'year, you put in 12.') gui.radioButtons(box, self, 'decomposition', self.DECOMPOSITION_MODELS, label='Decomposition model:', orientation=Qt.Horizontal, callback=self.on_changed) self.view = view = QListView(self, selectionMode=QListView.ExtendedSelection) self.model = model = VariableListModel(parent=self) view.setModel(model) view.selectionModel().selectionChanged.connect(self.on_changed) box.layout().addWidget(view) gui.auto_commit(box, self, 'autocommit', '&Apply')
def __init__(self): super().__init__() self.data = None gui.radioButtons(self.controlArea, self, "axis", ["rows", "columns"], box="Distances between", callback=self._invalidate) gui.comboBox(self.controlArea, self, "metric_idx", box="Distance Metric", items=list(zip(*_METRICS))[0], callback=self._invalidate) box = gui.auto_commit(self.buttonsArea, self, "autocommit", "Apply", box=False, checkbox_label="Apply on any change") box.layout().insertWidget(0, self.report_button) box.layout().insertSpacing(1, 8) self.layout().setSizeConstraint(self.layout().SetFixedSize)
def __init__(self): super().__init__() self.data = None gui.radioButtons(self.controlArea, self, "axis", ["Rows", "Columns"], box="Distances between", callback=self._invalidate) box = gui.widgetBox(self.controlArea, "Distance Metric") self.metrics_combo = gui.comboBox(box, self, "metric_idx", items=[m[0] for m in METRICS], callback=self._metric_changed) self.normalization_check = gui.checkBox( box, self, "normalized_dist", "Normalized", callback=self._invalidate, tooltip=("All dimensions are (implicitly) scaled to a common" "scale to normalize the influence across the domain.")) _, metric = METRICS[self.metric_idx] self.normalization_check.setEnabled(metric.supports_normalization) gui.auto_commit(self.controlArea, self, "autocommit", "Apply") self.layout().setSizeConstraint(self.layout().SetFixedSize)
def __init__(self): super().__init__() self.data = None gui.radioButtons(self.controlArea, self, "normalization_method", box="Normalization", btnLabels=[x[0] for x in self.normalization_options], callback=self._invalidate) gui.radioButtons(self.controlArea, self, "inversion_method", box="Inversion", btnLabels=[x[0] for x in self.inversion_options], callback=self._invalidate) box = gui.auto_commit(self.buttonsArea, self, "autocommit", "Apply", checkbox_label="Apply automatically", box=None) box.layout().insertWidget(0, self.report_button) box.layout().insertSpacing(1, 8)
def __init__(self): super().__init__() self.data = None gui.radioButtons(self.controlArea, self, "axis", ["Rows", "Columns"], box="Distances between", callback=self._invalidate) self.metrics_combo = gui.comboBox(self.controlArea, self, "metric_idx", box="Distance Metric", items=[m.name for m in METRICS], callback=self._invalidate) box = gui.auto_commit(self.buttonsArea, self, "autocommit", "Apply", box=False, checkbox_label="Apply automatically") box.layout().insertWidget(0, self.report_button) box.layout().insertSpacing(1, 8) self.layout().setSizeConstraint(self.layout().SetFixedSize)
def add_main_layout(self): # this is part of init, pylint: disable=attribute-defined-outside-init box = gui.hBox(self.controlArea, "Parameters") gui.checkBox(box, self, "fit_intercept", "Fit intercept (unchecking it fixes it to zero)", callback=self._intercept_changed) box = gui.hBox(self.controlArea, "Regularization") gui.radioButtons(box, self, "reg_type", btnLabels=self.REGULARIZATION_TYPES, callback=self._reg_type_changed) gui.separator(box, 20, 20) self.alpha_box = box2 = gui.vBox(box, margin=10) gui.widgetLabel(box2, "Regularization strength:") gui.hSlider(box2, self, "alpha_index", minValue=0, maxValue=len(self.alphas) - 1, callback=self._alpha_changed, createLabel=False) box3 = gui.hBox(box2) box3.layout().setAlignment(Qt.AlignCenter) self.alpha_label = gui.widgetLabel(box3, "") self._set_alpha_label() gui.separator(box2, 10, 10) box4 = gui.vBox(box2, margin=0) gui.widgetLabel(box4, "Elastic net mixing:") box5 = gui.hBox(box4) gui.widgetLabel(box5, "L1") self.l2_ratio_slider = gui.hSlider(box5, self, "l2_ratio", minValue=0.01, maxValue=0.99, intOnly=False, ticks=0.1, createLabel=False, width=120, step=0.01, callback=self._l2_ratio_changed) gui.widgetLabel(box5, "L2") self.l2_ratio_label = gui.widgetLabel( box4, "", sizePolicy=(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)) self.l2_ratio_label.setAlignment(Qt.AlignCenter) box5 = gui.hBox(self.controlArea) box5.layout().setAlignment(Qt.AlignCenter) self._set_l2_ratio_label() self.layout().setSizeConstraint(QLayout.SetFixedSize) self.controls.alpha_index.setEnabled(self.reg_type != self.OLS) self.l2_ratio_slider.setEnabled(self.reg_type == self.Elastic)
def _create_layout(self): self.mainArea.layout().addWidget(self.graphview) info = gui.widgetBox(self.controlArea, 'Info') gui.label(info, self, '%(n_object_types)d object types') gui.label(info, self, '%(n_relations)d relations') # Table view of relation details info = gui.widgetBox(self.controlArea, 'Relations') class TableView(gui.TableView): def __init__(self, parent=None, **kwargs): super().__init__(parent, **kwargs) self._parent = parent self.bold_font = self.BoldFontDelegate(self) # member because PyQt sometimes unrefs too early self.setItemDelegateForColumn(2, self.bold_font) self.setItemDelegateForColumn(4, self.bold_font) self.horizontalHeader().setVisible(False) def selectionChanged(self, selected, deselected): super().selectionChanged(selected, deselected) if not selected: assert len(deselected) > 0 relation = None else: assert len(selected) == 1 data = self._parent.tablemodel[selected[0].top()][0] relation = Relation(data) self._parent.send(Output.RELATION, relation) model = self.tablemodel = PyTableModel(parent=self) table = self.table = TableView(self, selectionMode=TableView.SingleSelection) table.setModel(model) info.layout().addWidget(self.table) gui.lineEdit(self.controlArea, self, 'pref_algo_name', 'Fuser name:', orientation='horizontal', callback=self.checkcommit, enterPlaceholder=True) gui.radioButtons(self.controlArea, self, 'pref_algorithm', [i[0] for i in DECOMPOSITION_ALGO], box='Decomposition algorithm', callback=self.checkcommit) gui.radioButtons(self.controlArea, self, 'pref_initialization', INITIALIZATION_ALGO, box='Initialization algorithm', callback=self.checkcommit) slider = gui.hSlider( self.controlArea, self, 'pref_n_iterations', 'Maximum number of iterations', minValue=10, maxValue=500, createLabel=True, callback=self.checkcommit) slider.setTracking(False) self.slider_rank = gui.hSlider(self.controlArea, self, 'pref_rank', 'Factorization rank', minValue=1, maxValue=100, createLabel=True, labelFormat=" %d%%", callback=self.checkcommit) self.slider_rank.setTracking(False) gui.auto_commit(self.controlArea, self, "autorun", "Run", checkbox_label="Run after any change ")
def __init__(self): OWWidget.__init__(self) ConcurrentWidgetMixin.__init__(self) self.data = None gui.radioButtons(self.controlArea, self, "axis", ["Rows", "Columns"], box="Distances between", callback=self._invalidate) box = gui.widgetBox(self.controlArea, "Distance Metric") self.metrics_combo = gui.comboBox(box, self, "metric_idx", items=[m[0] for m in METRICS], callback=self._metric_changed) self.normalization_check = gui.checkBox( box, self, "normalized_dist", "Normalized", callback=self._invalidate, tooltip=("All dimensions are (implicitly) scaled to a common" "scale to normalize the influence across the domain."), stateWhenDisabled=False) _, metric = METRICS[self.metric_idx] self.normalization_check.setEnabled(metric.supports_normalization) gui.auto_apply(self.controlArea, self, "autocommit")
def _create_layout(self): self.controlArea = self box = gui.widgetBox(self.controlArea, margin=7) box.layout().addWidget(self.webview) box = gui.widgetBox(self.controlArea, 'Latent chains') self.table = gui.TableWidget(box, select_rows=True) self.table.setColumnFilter(bold_item, lambda col: col % 2) def selectionChanged(selected, _): if not selected: data = None else: chain = self.table.rowData(selected[0].top()) self.webview.evalJS('dehighlight(ELEMENTS);') self._highlight_relations(chain) data = self.fuser.compute_chain(chain, self.pref_complete) self.send(Output.RELATION, data) self.table.selectionChanged = selectionChanged self.controlArea.layout().addWidget(box) def on_change_pref_complete(): ranges = self.table.selectedRanges() self._populate_table(self.chains) # Re-apply selection if ranges: self.table.selectRow(ranges[0].topRow()) gui.radioButtons(box, self, 'pref_complete', label='Complete chain to:', btnLabels=('latent space', 'feature space'), callback=on_change_pref_complete) self.controlArea.layout().addStretch(1)
def __init__(self): super().__init__() self.data = None gui.radioButtons(self.controlArea, self, "axis", ["Rows", "Columns"], box="Distances between", callback=self._invalidate ) box = gui.widgetBox(self.controlArea, "Distance Metric") self.metrics_combo = gui.comboBox( box, self, "metric_idx", items=[m[0] for m in METRICS], callback=self._metric_changed ) self.normalization_check = gui.checkBox( box, self, "normalized_dist", "Normalized", callback=self._invalidate, tooltip=("All dimensions are (implicitly) scaled to a common" "scale to normalize the influence across the domain.") ) _, metric = METRICS[self.metric_idx] self.normalization_check.setEnabled(metric.supports_normalization) gui.auto_commit(self.controlArea, self, "autocommit", "Apply") self.layout().setSizeConstraint(self.layout().SetFixedSize)
def add_main_layout(self): box = gui.hBox(self.controlArea, "Regularization") gui.radioButtons(box, self, "reg_type", btnLabels=self.REGULARIZATION_TYPES, callback=self._reg_type_changed) gui.separator(box, 20, 20) self.alpha_box = box2 = gui.vBox(box, margin=10) gui.widgetLabel(box2, "Regularization strength:") self.alpha_slider = gui.hSlider( box2, self, "alpha_index", minValue=0, maxValue=len(self.alphas) - 1, callback=self._alpha_changed, createLabel=False) box3 = gui.hBox(box2) box3.layout().setAlignment(Qt.AlignCenter) self.alpha_label = gui.widgetLabel(box3, "") self._set_alpha_label() gui.separator(box2, 10, 10) box4 = gui.vBox(box2, margin=0) gui.widgetLabel(box4, "Elastic net mixing:") box5 = gui.hBox(box4) gui.widgetLabel(box5, "L1") self.l1_ratio_slider = gui.hSlider( box5, self, "l1_ratio", minValue=0.01, maxValue=0.99, intOnly=False, ticks=0.1, createLabel=False, width=120, step=0.01, callback=self._l1_ratio_changed) gui.widgetLabel(box5, "L2") self.l1_ratio_label = gui.widgetLabel( box4, "", sizePolicy=(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)) self.l1_ratio_label.setAlignment(Qt.AlignCenter)
def add_main_layout(self): box = gui.widgetBox(self.controlArea, "Learner") gui.radioButtons(box, self, "learner_class", btnLabels=self.MODEL_NAMES, callback=self.settings_changed) self._set_name_learner()
def __init__(self, parent=None): super().__init__(parent) self.data = None box = gui.widgetBox(self.controlArea, self.tr("Distances Between")) gui.radioButtons(box, self, "axis", [self.tr("rows"), self.tr("columns")], callback=self._invalidate) box = gui.widgetBox(self.controlArea, self.tr("Distance Metric")) gui.comboBox(box, self, "metric_idx", items=list(zip(*_METRICS))[0], callback=self._invalidate) gui.auto_commit(self.controlArea, self, "autocommit", "Apply", checkbox_label="Apply on any change") self.layout().setSizeConstraint(self.layout().SetFixedSize)
def _create_layout(self): self.mainArea.layout().addWidget(self.graphview) info = gui.widgetBox(self.controlArea, 'Info') gui.label(info, self, '%(n_object_types)d object types') gui.label(info, self, '%(n_relations)d relations') # Table view of relation details info = gui.widgetBox(self.controlArea, 'Relations') class TableView(gui.TableView): def __init__(self, parent=None, **kwargs): super().__init__(parent, **kwargs) self._parent = parent self.bold_font = self.BoldFontDelegate(self) # member because PyQt sometimes unrefs too early self.setItemDelegateForColumn(2, self.bold_font) self.setItemDelegateForColumn(4, self.bold_font) self.horizontalHeader().setVisible(False) def selectionChanged(self, selected, deselected): super().selectionChanged(selected, deselected) if not selected: assert len(deselected) > 0 relation = None else: assert len(selected) == 1 data = self._parent.tablemodel[selected[0].top()][0] relation = Relation(data) self._parent.send(Output.RELATION, relation) model = self.tablemodel = PyTableModel(parent=self) table = self.table = TableView(self, selectionMode=TableView.SingleSelection) table.setModel(model) info.layout().addWidget(self.table) gui.lineEdit(self.controlArea, self, 'pref_algo_name', 'Fuser name:', orientation='horizontal', callback=self.checkcommit) gui.radioButtons(self.controlArea, self, 'pref_algorithm', [i[0] for i in DECOMPOSITION_ALGO], box='Decomposition algorithm', callback=self.checkcommit) gui.radioButtons(self.controlArea, self, 'pref_initialization', INITIALIZATION_ALGO, box='Initialization algorithm', callback=self.checkcommit) slider = gui.hSlider( self.controlArea, self, 'pref_n_iterations', 'Maximum number of iterations', minValue=10, maxValue=500, createLabel=True, callback=self.checkcommit) slider.setTracking(False) self.slider_rank = gui.hSlider(self.controlArea, self, 'pref_rank', 'Factorization rank', minValue=1, maxValue=100, createLabel=True, labelFormat=" %d%%", callback=self.checkcommit) self.slider_rank.setTracking(False) gui.auto_commit(self.controlArea, self, "autorun", "Run", checkbox_label="Run after any change ")
def _create_layout(self): info = gui.widgetBox(self.controlArea, 'Info') gui.label(info, self, '%(n_object_types)d object types') gui.label(info, self, '%(n_relations)d relations') # Table view of relation details info = gui.widgetBox(self.controlArea, 'Relations') def send_relation(item): data = item.data(QtCore.Qt.UserRole) self.send(Output.RELATION, Relation(data)) self.table = SimpleTableWidget(info, callback=send_relation) self.controlArea.layout().addStretch(1) gui.lineEdit(self.controlArea, self, 'pref_algo_name', 'Fuser name', callback=self.checkcommit, enterPlaceholder=True) gui.radioButtons(self.controlArea, self, 'pref_algorithm', [i[0] for i in DECOMPOSITION_ALGO], box='Decomposition algorithm', callback=self.checkcommit) gui.radioButtons(self.controlArea, self, 'pref_initialization', INITIALIZATION_ALGO, box='Initialization algorithm', callback=self.checkcommit) gui.hSlider(self.controlArea, self, 'pref_n_iterations', 'Maximum number of iterations', minValue=10, maxValue=500, createLabel=True, callback=self.checkcommit) self.slider_rank = gui.hSlider(self.controlArea, self, 'pref_rank', 'Factorization rank', minValue=1, maxValue=100, createLabel=True, labelFormat=" %d%%", callback=self.checkcommit) gui.auto_commit(self.controlArea, self, "autorun", "Run", checkbox_label="Run after any change ")
def __init__(self): super().__init__() self.data = None self.groups = None self.CVSettings = (self.stratified, self.numberOfFolds) infoBox = gui.widgetBox(self.controlArea, "Information") self.dataInfoLabel = gui.widgetLabel(infoBox, 'No data on input.') self.outputInfoLabel = gui.widgetLabel(infoBox, ' ') optionsBox = gui.widgetBox(self.controlArea, "Options") le = gui.lineEdit(optionsBox, self, "randomSeed", "Random seed: ", orientation=0, controlWidth=60, validator=QtGui.QIntValidator()) s = le.sizeHint().height() - 2 b = gui.toolButton(le.box, self, width=s, height=s, callback=lambda: le.setText("")) b.setIcon(b.style().standardIcon(b.style().SP_DialogCancelButton)) gui.rubber(le.box) gui.checkBox(optionsBox, self, "stratified", "Stratified, if possible") sampling = gui.radioButtons( self.controlArea, self, "samplingType", box="Sampling type", addSpace=True) gui.appendRadioButton(sampling, "Random Sampling:") indRndSmpl = gui.indentedBox(sampling) sizeType = gui.radioButtons( indRndSmpl, self, "sampleSizeType", callback=lambda: self.chooseSampling(0)) gui.appendRadioButton(sizeType, "Sample size:", insertInto=indRndSmpl) self.sampleSizeSpin = gui.spin( gui.indentedBox(indRndSmpl), self, "sampleSizeNumber", 1, 1000000000, callback=[lambda: self.chooseSampling(0), lambda: self.chooseSizeType(0)]) gui.appendRadioButton(sizeType, "Sample proportions:", insertInto=indRndSmpl) gui.hSlider(gui.indentedBox(indRndSmpl), self, "sampleSizePercentage", minValue=1, maxValue=100, ticks=10, labelFormat="%d%%", callback=[lambda: self.chooseSampling(0), lambda: self.chooseSizeType(1)]) gui.appendRadioButton(sampling, "Cross Validation:") crossValidIndent = gui.indentedBox(sampling) gui.spin( crossValidIndent, self, "numberOfFolds", 2, 100, label="Number of folds:", callback=[self.updateSelectedFoldSpin, lambda: self.chooseSampling(1)]) self.selectedFoldSpin = gui.spin( crossValidIndent, self, "selectedFold", 1, 100, label="Selected fold:", callback=[self.updateSelectedFoldSpin, lambda: self.chooseSampling(1)]) gui.button(self.controlArea, self, "Sample Data", callback=self.sendData)
def add_main_layout(self): # this is part of init, pylint: disable=attribute-defined-outside-init box = gui.hBox(self.controlArea, 'Regularization') gui.radioButtons( box, self, 'reg_type', btnLabels=self.REGULARIZATION_TYPES, callback=self._reg_type_changed, ) gui.separator(box, 20, 20) self.alpha_box = box2 = gui.vBox(box, margin=10) gui.widgetLabel(box2, 'Regularization strength:') gui.hSlider( box2, self, 'alpha_index', minValue=0, maxValue=len(self.alphas) - 1, callback=self._alpha_changed, createLabel=False, ) box3 = gui.hBox(box2) box3.layout().setAlignment(Qt.AlignCenter) self.alpha_label = gui.widgetLabel(box3, '') self._set_alpha_label() gui.separator(box2, 10, 10) box4 = gui.vBox(box2, margin=0) gui.widgetLabel(box4, 'Elastic net mixing:') box5 = gui.hBox(box4) gui.widgetLabel(box5, 'L1') self.l2_ratio_slider = gui.hSlider( box5, self, 'l2_ratio', minValue=0.01, maxValue=0.99, intOnly=False, ticks=0.1, createLabel=False, width=120, step=0.01, callback=self._l2_ratio_changed, ) gui.widgetLabel(box5, 'L2') self.l2_ratio_label = gui.widgetLabel( box4, "", sizePolicy=(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)) self.l2_ratio_label.setAlignment(Qt.AlignCenter) box5 = gui.hBox(self.controlArea) box5.layout().setAlignment(Qt.AlignCenter) self._set_l2_ratio_label() self.layout().setSizeConstraint(QLayout.SetFixedSize) self.controls.alpha_index.setEnabled(self.reg_type != self.COX) self.l2_ratio_slider.setEnabled(self.reg_type == self.Elastic)
def __init__(self): super().__init__() self.results = None self.classifier_names = [] self.colors = [] self._points_hull: Dict[Tuple[int, int], PointsAndHull] = {} box = gui.vBox(self.controlArea, box="Curve") self.target_cb = gui.comboBox( box, self, "target_index", label="Target: ", orientation=Qt.Horizontal, callback=self._on_target_changed, contentsLength=8, searchable=True ) gui.radioButtons( box, self, "curve_type", ("Lift Curve", "Cumulative Gains"), callback=self._on_curve_type_changed ) self.classifiers_list_box = gui.listBox( self.controlArea, self, "selected_classifiers", "classifier_names", box="Models", selectionMode=QListView.MultiSelection, callback=self._on_classifiers_changed ) self.classifiers_list_box.setMaximumHeight(100) gui.checkBox(self.controlArea, self, "display_convex_hull", "Show convex hull", box="Settings", callback=self._replot) gui.rubber(self.controlArea) self.plotview = GraphicsView() self.plotview.setFrameStyle(QFrame.StyledPanel) self.plot = PlotItem(enableMenu=False) self.plot.parameter_setter = ParameterSetter(self.plot) self.plot.curve_items = [] self.plot.hull_items = [] self.plot.default_line_item = None self.plot.display_convex_hull = self.display_convex_hull self.plot.setMouseEnabled(False, False) self.plot.hideButtons() tickfont = QFont(self.font()) tickfont.setPixelSize(max(int(tickfont.pixelSize() * 2 // 3), 11)) for pos, label in (("bottom", "P Rate"), ("left", "")): axis = self.plot.getAxis(pos) axis.setTickFont(tickfont) axis.setLabel(label) self._set_left_label() self.plot.showGrid(True, True, alpha=0.1) self.plotview.setCentralItem(self.plot) self.mainArea.layout().addWidget(self.plotview) VisualSettingsDialog(self, self.plot.parameter_setter.initial_settings)
def __init__(self, parent_widget, parent_component): QObject.__init__(self) OWComponent.__init__(self, widget=parent_widget) box = gui.widgetBox(parent_component, self.BOX_TITLE, margin=3) gui.checkBox(box, self, 'quantile_norm', self.QUANTILE_NORM_LABEL, callback=self.options_changed.emit) gui.checkBox(box, self, 'log_norm', self.LOG_NORM_LABEL, callback=self.options_changed.emit) gui.checkBox(box, self, 'z_score_norm', self.Z_SCORE_LABEL, callback=self.on_z_score_selected) self.z_score_axis_btn = gui.radioButtons( gui.indentedBox(box), self, 'z_score_axis', btnLabels=['columns', 'rows'], callback=self.options_changed.emit, orientation=Qt.Horizontal, ) self.z_score_axis_btn.setHidden(not bool(self.z_score_norm)) gui.checkBox( box, self, 'quantile_transform', self.QUANTILE_TRANSFORM_LABEL, callback=self.on_quantile_transform_selected, ) self.quantile_transform_axis_btn = gui.radioButtons( gui.indentedBox(box), self, 'quantile_transform_axis', btnLabels=['columns', 'rows'], callback=self.options_changed.emit, orientation=Qt.Horizontal, ) self.quantile_transform_dist_btn = gui.radioButtons( gui.indentedBox(box), self, 'quantile_transform_dist', btnLabels=QuantileTransformDist.values(), callback=self.options_changed.emit, orientation=Qt.Horizontal, ) self.quantile_transform_axis_btn.setHidden( not bool(self.quantile_transform)) self.quantile_transform_dist_btn.setHidden( not bool(self.quantile_transform))
def set_test_type(self, settings_var): # type: (str) -> None self.test_type = settings_var radioButtons(self.widget, self.parent, self.test_type, list(map(lambda s: s.title(), ALTERNATIVES)), callback=self.on_test_type_changed, label='Test Type')
def add_main_layout(self): gui.radioButtons( self.controlArea, self, "calibration", self.CalibrationOptions, box="概率校准", callback=self.calibration_options_changed) gui.radioButtons( self.controlArea, self, "threshold", self.ThresholdOptions, box="决策阈值优化", callback=self.calibration_options_changed)
def add_main_layout(self): gui.radioButtons( self.controlArea, self, "calibration", self.CalibrationOptions, box="Probability calibration", callback=self.calibration_options_changed) gui.radioButtons( self.controlArea, self, "threshold", self.ThresholdOptions, box="Decision threshold optimization", callback=self.calibration_options_changed)
def set_method_design_area(self, settings_var): # type: (str) -> None self.scoring_method_design = settings_var radioButtons(self.widget, self.parent, self.scoring_method_design, ['Cluster vs. rest', 'Cluster vs. cluster (max p-value)'], callback=self.on_design_selection_changed, label='Design')
def __init__(self): super().__init__() self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, "Learner/Predictor Name") gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, "Regularization", orientation="horizontal") gui.radioButtons( box, self, "reg_type", btnLabels=["No regularization", "Ridge regression (L2)", "Lasso regression (L1)", "Elastic net regression"], callback=self._reg_type_changed) gui.separator(box, 20, 20) self.alpha_box = box2 = gui.widgetBox(box, margin=0) gui.widgetLabel(box2, "Regularization strength") self.alpha_slider = gui.hSlider( box2, self, "alpha_index", minValue=0, maxValue=len(self.alphas) - 1, callback=self._alpha_changed, createLabel=False) box3 = gui.widgetBox(box2, orientation="horizontal") box3.layout().setAlignment(Qt.AlignCenter) self.alpha_label = gui.widgetLabel(box3, "") self._set_alpha_label() gui.separator(box2, 10, 10) box4 = gui.widgetBox(box2, margin=0) gui.widgetLabel(box4, "Elastic net mixing") box5 = gui.widgetBox(box4, orientation="horizontal") gui.widgetLabel(box5, "L1") self.l1_ratio_slider = gui.hSlider( box5, self, "l1_ratio", minValue=0.01, maxValue=1, intOnly=False, ticks=0.1, createLabel=False, step=0.01, callback=self._l1_ratio_changed) gui.widgetLabel(box5, "L2") box5 = gui.widgetBox(box4, orientation="horizontal") box5.layout().setAlignment(Qt.AlignCenter) self.l1_ratio_label = gui.widgetLabel(box5, "") self._set_l1_ratio_label() auto_commit = gui.auto_commit( self.controlArea, self, "autosend", "Apply", auto_label="Apply on change") gui.separator(box, 20) auto_commit.layout().addWidget(self.report_button) self.report_button.setMinimumWidth(150) self.layout().setSizeConstraint(QLayout.SetFixedSize) self.alpha_slider.setEnabled(self.reg_type != self.OLS) self.l1_ratio_slider.setEnabled(self.reg_type == self.Elastic) self.commit()
def _create_layout(self): self.controlArea = self box = gui.widgetBox(self.controlArea, margin=7) box.layout().addWidget(self.graphview) box = gui.widgetBox(self.controlArea, 'Latent chains') class TableView(gui.TableView): selected_row = pyqtSignal(int) def __init__(self, parent): super().__init__(parent, selectionMode=self.SingleSelection) self._parent = parent self.bold_font = self.BoldFontDelegate( self) # member because PyQt sometimes unrefs too early for column in range(2, 100, 2): self.setItemDelegateForColumn(column, self.bold_font) self.horizontalHeader().setVisible(False) def selectionChanged(self, selected, deselected): super().selectionChanged(selected, deselected) self.selected_row.emit( selected.indexes()[0].row() if len(selected) else -1) model = self.model = PyTableModel(parent=self) table = self.table = TableView(self) table.setModel(model) def selected_row(row): data = None if row >= 0: chain = self.model[row][0] self.graphview.clearSelection() self._highlight_relations(chain) data = self.fuser.compute_chain(chain, self.pref_complete) self.Outputs.relation.send(data) table.selected_row.connect(selected_row) box.layout().addWidget(table) self.controlArea.layout().addWidget(box) def on_change_pref_complete(): rows = self.table.selectionModel().selectedRows() self._populate_table(self.chains) # Re-apply selection if rows: self.table.selectRow(rows[0].row()) gui.radioButtons(box, self, 'pref_complete', label='Complete chain to:', btnLabels=('latent space', 'feature space'), callback=on_change_pref_complete) self.controlArea.layout().addStretch(1)
def _create_layout(self): self.controlArea = self box = gui.widgetBox(self.controlArea, margin=7) box.layout().addWidget(self.webview) box = gui.widgetBox(self.controlArea, 'Latent chains') self.table = SimpleTableWidget(box, callback=self.on_selected_chain) self.controlArea.layout().addWidget(box) gui.radioButtons(box, self, 'pref_complete', label='Complete chain to:', btnLabels=('latent space', 'feature space'), callback=self.on_change_pref_complete) self.controlArea.layout().addStretch(1)
def __init__(self): super().__init__() self.corpus = None gui.radioButtons(self.controlArea, self, "method_idx", box="Method", btnLabels=[m.name for m in METHODS], callback=self._method_changed) ac = gui.auto_commit(self.controlArea, self, 'autocommit', 'Commit', 'Autocommit is on') ac.layout().insertWidget(0, self.report_button) ac.layout().insertSpacing(1, 8)
def _create_layout(self): self.controlArea = self box = gui.widgetBox(self.controlArea, margin=7) box.layout().addWidget(self.graphview) box = gui.widgetBox(self.controlArea, 'Latent chains') class TableView(gui.TableView): selected_row = pyqtSignal(int) def __init__(self, parent): super().__init__(parent, selectionMode=self.SingleSelection) self._parent = parent self.bold_font = self.BoldFontDelegate(self) # member because PyQt sometimes unrefs too early for column in range(2, 100, 2): self.setItemDelegateForColumn(column, self.bold_font) self.horizontalHeader().setVisible(False) def selectionChanged(self, selected, deselected): super().selectionChanged(selected, deselected) self.selected_row.emit(selected.indexes()[0].row() if len(selected) else -1) model = self.model = PyTableModel(parent=self) table = self.table = TableView(self) table.setModel(model) def selected_row(row): data = None if row >= 0: chain = self.model[row][0] self.graphview.clearSelection() self._highlight_relations(chain) data = self.fuser.compute_chain(chain, self.pref_complete) self.Outputs.relation.send(data) table.selected_row.connect(selected_row) box.layout().addWidget(table) self.controlArea.layout().addWidget(box) def on_change_pref_complete(): rows = self.table.selectionModel().selectedRows() self._populate_table(self.chains) # Re-apply selection if rows: self.table.selectRow(rows[0].row()) gui.radioButtons(box, self, 'pref_complete', label='Complete chain to:', btnLabels=('latent space', 'feature space'), callback=on_change_pref_complete) self.controlArea.layout().addStretch(1)
def add_main_layout(self): def add_form(box): gui.separator(box) box2 = gui.hBox(box) gui.rubber(box2) form = QtGui.QFormLayout() form.setContentsMargins(0, 0, 0, 0) box2.layout().addLayout(form) return form box = gui.radioButtons( self.controlArea, self, "loss_function", box="Loss Function", btnLabels=self.LOSS_FUNCTIONS, callback=self._on_func_changed, orientation=Qt.Vertical) form = add_form(box) epsilon = gui.doubleSpin( box, self, "epsilon", 0.0, 10.0, 0.01, controlWidth=70) form.addRow("ε:", epsilon) self._func_params = [epsilon] self._on_func_changed() box = gui.radioButtons( self.controlArea, self, "penalty_type", box="Penalty", btnLabels=self.PENALTIES, callback=self._on_penalty_changed, orientation=Qt.Vertical) form = add_form(box) alpha = gui.doubleSpin( box, self, "alpha", 0.0, 10.0, 0.0001, controlWidth=80) form.addRow("α:", alpha) l1_ratio = gui.doubleSpin( box, self, "l1_ratio", 0.0, 10.0, 0.01, controlWidth=80) form.addRow("L1 ratio:", l1_ratio) self._penalty_params = [l1_ratio] self._on_penalty_changed() box = gui.radioButtons( self.controlArea, self, "learning_rate", box="Learning Rate", btnLabels=self.LEARNING_RATES, callback=self._on_lrate_changed, orientation=Qt.Vertical) form = add_form(box) spin = gui.doubleSpin( box, self, "eta0", 0.0, 10, 0.01, controlWidth=70) form.addRow("η<sub>0</sub>:", spin) power_t = gui.doubleSpin( box, self, "power_t", 0.0, 10.0, 0.01, controlWidth=70) form.addRow("Power t:", power_t) gui.separator(box, height=8) niterations = gui.doubleSpin( box, self, "n_iter", 1, 1e+6, 1, controlWidth=70) form.addRow("Number of iterations:", niterations) self._lrate_params = [power_t] self._on_lrate_changed()
def __init__(self): box = gui.widgetBox(self.controlArea, 'Yahoo Finance Stock Data', orientation='horizontal') lbox = gui.widgetBox(box, orientation='vertical') hbox = gui.widgetBox(lbox, orientation='horizontal') gui.label(hbox, self, 'Ticker:') self.combo = combo = QComboBox(editable=True, insertPolicy=QComboBox.InsertAtTop) combo.addItems(self.symbols) hbox.layout().addWidget(combo) # combo = gui.comboBox( # lbox, self, 'symbol',#, items=self.symbols, # label='Ticker:', orientation='horizontal', # editable=True, maximumContentsLength=-1) gui.rubber(combo.parentWidget()) minDate = QDate.fromString(self.MIN_DATE.strftime(self.PY_DATE_FORMAT), self.QT_DATE_FORMAT) date_from = QDateEdit(QDate.fromString(self.date_from, self.QT_DATE_FORMAT), displayFormat=self.QT_DATE_FORMAT, minimumDate=minDate, calendarPopup=True) date_to = QDateEdit(QDate.fromString(self.date_to, self.QT_DATE_FORMAT), displayFormat=self.QT_DATE_FORMAT, minimumDate=minDate, calendarPopup=True) date_from.dateChanged.connect(lambda date: setattr( self, 'date_from', date.toString(self.QT_DATE_FORMAT))) date_to.dateChanged.connect(lambda date: setattr( self, 'date_to', date.toString(self.QT_DATE_FORMAT))) hbox = gui.hBox(lbox) gui.label(hbox, self, "From:") hbox.layout().addWidget(date_from) hbox = gui.hBox(lbox) gui.label(hbox, self, "To:") hbox.layout().addWidget(date_to) gui.radioButtons(box, self, 'data_granularity', btnLabels=[ i.name.capitalize().replace('_', ' ') for i in DataGranularity ], box='Resolution') self.button = gui.button(self.controlArea, self, 'Download', callback=self.download)
def __init__(self): self._header_labels = hls = [label for _, label in self.HEADER_SCHEMA] header = namedtuple("header", [tag for tag, _ in self.HEADER_SCHEMA]) self._Header = header(*[index for index, _ in enumerate(hls)]) self.view = MultiSampleTreeView(self) self._view_setup() self._assign_delegates() super().__init__() file_label = self.file_layout.itemAtPosition(0, 0).widget() file_label.setText("Add file:") self.recent_combo.setLineEdit(RecentLineEdit(self)) self.recent_combo.setCurrentText("Recent files") self.__recent_combo_view_resize() open_button = self.file_layout.itemAtPosition(0, 2).widget() open_button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) open_button.setText("Browse...") open_button.setIcon(QIcon()) self.summary_label.hide() self.load_data_button.hide() self.controlArea.layout().removeItem(self.file_layout) self.controlArea.setSizePolicy( QSizePolicy.Fixed, QSizePolicy.MinimumExpanding) main_box = gui.hBox(self.left_side, margin=4) left_box = gui.vBox(main_box, spacing=10) left_box.layout().addLayout(self.file_layout) left_box.layout().addWidget(self.view) right_box = gui.vBox(main_box) right_box.layout().addWidget(self.controlArea) output_box = gui.hBox(left_box) box = gui.widgetBox(output_box, True) gui.radioButtons( box, self, "output_type", self.OUTPUT_TYPES, label="Output genes:", orientation=Qt.Horizontal, callback=self._output_type_changed ) gui.rubber(output_box) cb_box = gui.auto_commit(output_box, self, "auto_commit", "Load Data") cb_box.setMaximumWidth(250) self.left_side.layout().addWidget(main_box) self.read_settings() self.view.setFocus() self.cells_in_rows_changed.connect(self._update_view_cells_genes)
def add_main_layout(self): box = gui.vBox(self.controlArea, box='Parameters') gui.spin(box, self, 'maxlags', 1, 100, label='Maximum auto-regression order:', callback=self.apply) gui.radioButtons( box, self, 'ic', btnLabels=tuple(self.IC_LABELS.keys()), box='Information criterion', label='Optimize AR order by:', callback=self.apply) gui.radioButtons( box, self, 'trend', btnLabels=tuple(self.TREND_LABELS.keys()), box='Trend', label='Add trend vector(s):', callback=self.apply)
def __init__(self): super().__init__() self.data = None box = gui.widgetBox(self.controlArea, self.tr("Distances Between")) gui.radioButtons(box, self, "axis", [self.tr("rows"), self.tr("columns")], callback=self._invalidate) box = gui.widgetBox(self.controlArea, self.tr("Distance Metric")) gui.comboBox(box, self, "metric_idx", items=list(zip(*_METRICS))[0], callback=self._invalidate) gui.auto_commit(self.controlArea, self, "autocommit", "Apply", checkbox_label="Apply on any change") self.layout().setSizeConstraint(self.layout().SetFixedSize)
def __init__(self): super().__init__() self.saved_selections = [] self.box_selection = gui.widgetBox(self.controlArea, "Selection Mode") gui.radioButtons(self.box_selection, self, 'selection_mode', ["None", "Rectangle", "Circle", "Polygone"]) # https://matplotlib.org/stable/users/event_handling.html self.display.canvas.mpl_connect('button_release_event', self.onRelease) self.display.canvas.mpl_connect('motion_notify_event', self.onMouseMove) self.display.canvas.mpl_connect('button_press_event', self.onPress)
def __init__(self): super().__init__() self.METHODS = [ Liu_Hu_Sentiment(), Vader_Sentiment() ] self.corpus = None gui.radioButtons(self.controlArea, self, "method_idx", box="Method", btnLabels=[m.name for m in self.METHODS], callback=self._method_changed) ac = gui.auto_commit(self.controlArea, self, 'autocommit', 'Commit', 'Autocommit is on') ac.layout().insertSpacing(1, 8)
def __init__(self): super().__init__() self.data = None gui.radioButtons(self.controlArea, self, "axis", ["Rows", "Columns"], box="Distances between", callback=self._invalidate ) self.metrics_combo = gui.comboBox(self.controlArea, self, "metric_idx", box="Distance Metric", items=[m[0] for m in METRICS], callback=self._invalidate ) gui.auto_commit(self.controlArea, self, "autocommit", "Apply") self.layout().setSizeConstraint(self.layout().SetFixedSize)
def _create_layout(self): self.mainArea.layout().addWidget(self.graphview) info = gui.widgetBox(self.controlArea, 'Info') gui.label(info, self, '%(n_object_types)d object types') gui.label(info, self, '%(n_relations)d relations') # Table view of relation details info = gui.widgetBox(self.controlArea, 'Relations') def send_relation(selected, deselected): if not selected: assert len(deselected) > 0 relation = None else: assert len(selected) == 1 data = self.table.rowData(selected[0].top()) relation = Relation(data) self.send(Output.RELATION, relation) self.table = gui.TableWidget(info, select_rows=True) self.table.selectionChanged = send_relation self.table.setColumnFilter(bold_item, (1, 3)) gui.lineEdit(self.controlArea, self, 'pref_algo_name', 'Fuser name:', orientation='horizontal', callback=self.checkcommit, enterPlaceholder=True) gui.radioButtons(self.controlArea, self, 'pref_algorithm', [i[0] for i in DECOMPOSITION_ALGO], box='Decomposition algorithm', callback=self.checkcommit) gui.radioButtons(self.controlArea, self, 'pref_initialization', INITIALIZATION_ALGO, box='Initialization algorithm', callback=self.checkcommit) slider = gui.hSlider( self.controlArea, self, 'pref_n_iterations', 'Maximum number of iterations', minValue=10, maxValue=500, createLabel=True, callback=self.checkcommit) slider.setTracking(False) self.slider_rank = gui.hSlider(self.controlArea, self, 'pref_rank', 'Factorization rank', minValue=1, maxValue=100, createLabel=True, labelFormat=" %d%%", callback=self.checkcommit) self.slider_rank.setTracking(False) gui.auto_commit(self.controlArea, self, "autorun", "Run", checkbox_label="Run after any change ")
def __init__(self): super().__init__() self.data_points_interpolate = None dbox = gui.widgetBox(self.controlArea, "Interpolation") rbox = gui.radioButtons( dbox, self, "input_radio", callback=self._change_input) gui.appendRadioButton(rbox, "Enable automatic interpolation") gui.appendRadioButton(rbox, "Linear interval") ibox = gui.indentedBox(rbox) form = QWidget() formlayout = QFormLayout() form.setLayout(formlayout) ibox.layout().addWidget(form) self.xmin_edit = lineEditFloatOrNone(ibox, self, "xmin", callback=self.commit) formlayout.addRow("Min", self.xmin_edit) self.xmax_edit = lineEditFloatOrNone(ibox, self, "xmax", callback=self.commit) formlayout.addRow("Max", self.xmax_edit) self.dx_edit = lineEditFloatOrNone(ibox, self, "dx", callback=self.commit) formlayout.addRow("Δ", self.dx_edit) gui.appendRadioButton(rbox, "Reference data") self.data = None gui.auto_commit(self.controlArea, self, "autocommit", "Interpolate") self._change_input()
def __init__(self, parent=None): super().__init__(parent) self.train_data = None self.test_data = None #: An Ordered dictionary with current inputs and their testing #: results. self.learners = OrderedDict() sbox = gui.widgetBox(self.controlArea, "Sampling") rbox = gui.radioButtons( sbox, self, "resampling", callback=self._param_changed ) gui.appendRadioButton(rbox, "Cross validation") ibox = gui.indentedBox(rbox) gui.spin(ibox, self, "k_folds", 2, 50, label="Number of folds:", callback=self.kfold_changed) gui.appendRadioButton(rbox, "Leave one out") gui.appendRadioButton(rbox, "Random sampling") ibox = gui.indentedBox(rbox) gui.spin(ibox, self, "n_repeat", 2, 50, label="Repeat train/test", callback=self.bootstrap_changed) gui.widgetLabel(ibox, "Relative training set size:") gui.hSlider(ibox, self, "sample_p", minValue=1, maxValue=100, ticks=20, vertical=False, labelFormat="%d %%", callback=self.bootstrap_changed) gui.appendRadioButton(rbox, "Test on train data") gui.appendRadioButton(rbox, "Test on test data") rbox.layout().addSpacing(5) gui.button(rbox, self, "Apply", callback=self.apply) self.cbox = gui.widgetBox(self.controlArea, "Target class") self.class_selection_combo = gui.comboBox(self.cbox, self, "class_selection", items=[], callback=self._select_class, sendSelectedValue=True, valueType=str) gui.rubber(self.controlArea) self.view = QTreeView( rootIsDecorated=False, uniformRowHeights=True, wordWrap=True, editTriggers=QTreeView.NoEditTriggers ) header = self.view.header() header.setResizeMode(QHeaderView.ResizeToContents) header.setDefaultAlignment(Qt.AlignCenter) header.setStretchLastSection(False) self.result_model = QStandardItemModel() self.view.setModel(self.result_model) self.view.setItemDelegate(ItemDelegate()) self._update_header() box = gui.widgetBox(self.mainArea, "Evaluation Results") box.layout().addWidget(self.view)
def __init__(self, parent=None): super().__init__(parent) self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, "Learner/Predictor Name") gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, "Options") box = gui.radioButtons(box, self, "reg_type", callback=self._reg_type_changed) gui.appendRadioButton(box, "Ordinary linear regression") gui.appendRadioButton(box, "Ridge regression") ibox = gui.indentedBox(box) gui.doubleSpin(ibox, self, "ridgealpha", 0.0, 1000.0, label="alpha:") self.ridge_box = ibox gui.appendRadioButton(box, "Lasso regression") ibox = gui.indentedBox(box) gui.doubleSpin(ibox, self, "lassoalpha", 0.0, 1000.0, label="alpha") self.lasso_box = ibox gui.button(self.controlArea, self, "Apply", callback=self.apply, default=True) self.layout().setSizeConstraint(QLayout.SetFixedSize) self.ridge_box.setEnabled(self.reg_type == self.Ridge) self.lasso_box.setEnabled(self.reg_type == self.Lasso) self.apply()
def __init__(self): super().__init__() dbox = gui.widgetBox(self.controlArea, "Image values") rbox = gui.radioButtons( dbox, self, "value_type", callback=self._change_integration) gui.appendRadioButton(rbox, "From spectra") self.box_values_spectra = gui.indentedBox(rbox) gui.comboBox( self.box_values_spectra, self, "integration_method", valueType=int, items=(a.name for a in self.integration_methods), callback=self._change_integral_type) gui.rubber(self.controlArea) gui.appendRadioButton(rbox, "Use feature") self.box_values_feature = gui.indentedBox(rbox) self.feature_value_model = DomainModel(DomainModel.METAS | DomainModel.CLASSES, valid_types=DomainModel.PRIMITIVE) self.feature_value = gui.comboBox( self.box_values_feature, self, "attr_value", callback=self.update_feature_value, model=self.feature_value_model, sendSelectedValue=True, valueType=str) splitter = QSplitter(self) splitter.setOrientation(Qt.Vertical) self.imageplot = ImagePlot(self) self.imageplot.selection_changed.connect(self.output_image_selection) self.curveplot = CurvePlotHyper(self, select=SELECTONE) self.curveplot.selection_changed.connect(self.redraw_data) self.curveplot.plot.vb.x_padding = 0.005 # pad view so that lines are not hidden splitter.addWidget(self.imageplot) splitter.addWidget(self.curveplot) self.mainArea.layout().addWidget(splitter) self.line1 = MovableVline(position=self.lowlim, label="", report=self.curveplot) self.line1.sigMoved.connect(lambda v: setattr(self, "lowlim", v)) self.line2 = MovableVline(position=self.highlim, label="", report=self.curveplot) self.line2.sigMoved.connect(lambda v: setattr(self, "highlim", v)) self.line3 = MovableVline(position=self.choose, label="", report=self.curveplot) self.line3.sigMoved.connect(lambda v: setattr(self, "choose", v)) for line in [self.line1, self.line2, self.line3]: line.sigMoveFinished.connect(self.changed_integral_range) self.curveplot.add_marking(line) line.hide() self.data = None self.disable_integral_range = False self.resize(900, 700) self._update_integration_type() # prepare interface according to the new context self.contextAboutToBeOpened.connect(lambda x: self.init_interface_data(x[0]))
def __init__(self): super().__init__() self.data = None gui.radioButtons(self.controlArea, self, "normalization_method", box="Normalization", btnLabels=[x[0] for x in self.normalization_options], callback=self._invalidate) gui.radioButtons(self.controlArea, self, "inversion_method", box="Inversion", btnLabels=[x[0] for x in self.inversion_options], callback=self._invalidate) gui.auto_commit(self.controlArea, self, "autocommit", "Apply")
def _setup_input_box(self): gui.comboBox(self.__input_box, self, "words_var", label="Word variable:", orientation=Qt.Vertical, model=self.__input_words_model, callback=self._apply_update_rule) gui.radioButtons(self.__input_box, self, "update_rule_index", UpdateRules.ITEMS, label="Update: ", orientation=Qt.Vertical, callback=self.__on_update_rule_changed) self.__input_box.setEnabled(False)
def __init__(self): super().__init__() box = gui.widgetBox(self.controlArea, "Movie Selection (from %d)" % len(movielens.get_all_movie_names())) methodbox = gui.radioButtons(box, self, "method", callback=self._on_method_changed) gui.appendRadioButton(methodbox, "Fraction of movies") percent = gui.hSlider( gui.indentedBox(methodbox), self, "percent", minValue=1, maxValue=100, step=1, ticks=10, labelFormat="%d %%" ) gui.appendRadioButton(methodbox, "Time period:") ibox = gui.indentedBox(methodbox) start = gui.spin(ibox, self, "start", 1907, 2015, 1, label="Starting year: ") end = gui.spin(ibox, self, "end", 1907, 2015, 1, label="Ending year: ") self.method_params = [percent, start, end] gui.button(self.controlArea, self, "&Apply", callback=self.send_output, default=True) self.setSizePolicy(QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)) self.setMinimumWidth(250) self.setMaximumWidth(250) self._on_method_changed() self.send_output()
def __init__(self): super().__init__() self.data = None box = gui.radioButtons( self.controlArea, self, "feature_type", box="Feature names", callback=lambda: self.apply()) button = gui.appendRadioButton(box, "Generic") edit = gui.lineEdit( gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self, "feature_name", placeholderText="Type a prefix ...", toolTip="Custom feature name") edit.editingFinished.connect(self._apply_editing) self.meta_button = gui.appendRadioButton(box, "From meta attribute:") self.feature_model = DomainModel( order=DomainModel.METAS, valid_types=StringVariable, alphabetical=True) self.feature_combo = gui.comboBox( gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self, "feature_names_column", callback=self._feature_combo_changed, model=self.feature_model) self.apply_button = gui.auto_commit( self.controlArea, self, "auto_apply", "&Apply", box=False, commit=self.apply) self.apply_button.button.setAutoDefault(False) self.set_controls()
def __init__(self): super().__init__() self.data = None self.preprocessors = None box = gui.widgetBox(self.controlArea, "Learner/Predictor Name") gui.lineEdit(box, self, "learner_name") box = gui.widgetBox(self.controlArea, "Regularization") box = gui.radioButtons( box, self, "reg_type", btnLabels=["No regularization", "Ridge regression", "Lasso regression"], callback=self._reg_type_changed) gui.separator(box) self.alpha_box = box2 = gui.widgetBox(box, margin=0) gui.widgetLabel(box2, "Regularization strength") self.alpha_slider = gui.hSlider( box2, self, "alpha_index", minValue=0, maxValue=len(self.alphas) - 1, callback=self._alpha_changed, createLabel=False) box3 = gui.widgetBox(box, orientation="horizontal") box3.layout().setAlignment(Qt.AlignCenter) self.alpha_label = gui.widgetLabel(box3, "") self._set_alpha_label() gui.auto_commit(self.controlArea, self, "autosend", "Apply", checkbox_label="Apply on every change") self.layout().setSizeConstraint(QLayout.SetFixedSize) self.alpha_slider.setEnabled(self.reg_type != self.OLS) self.commit()
def __init__(self): box = gui.widgetBox(self.controlArea, 'Yahoo Finance Stock Data', orientation='horizontal') lbox = gui.widgetBox(box, orientation='vertical') hbox = gui.widgetBox(lbox, orientation='horizontal') gui.label(hbox, self, 'Ticker:') self.combo = combo = QComboBox(editable=True, insertPolicy=QComboBox.InsertAtTop) combo.addItems(self.symbols) hbox.layout().addWidget(combo) # combo = gui.comboBox( # lbox, self, 'symbol',#, items=self.symbols, # label='Ticker:', orientation='horizontal', # editable=True, maximumContentsLength=-1) gui.rubber(combo.parentWidget()) minDate = QDate.fromString(self.MIN_DATE.strftime(self.PY_DATE_FORMAT), self.QT_DATE_FORMAT) date_from = QDateEdit( QDate.fromString(self.date_from, self.QT_DATE_FORMAT), displayFormat=self.QT_DATE_FORMAT, minimumDate=minDate, calendarPopup=True) date_to = QDateEdit( QDate.fromString(self.date_to, self.QT_DATE_FORMAT), displayFormat=self.QT_DATE_FORMAT, minimumDate=minDate, calendarPopup=True) date_from.dateChanged.connect( lambda date: setattr(self, 'date_from', date.toString(self.QT_DATE_FORMAT))) date_to.dateChanged.connect( lambda date: setattr(self, 'date_to', date.toString(self.QT_DATE_FORMAT))) hbox = gui.hBox(lbox) gui.label(hbox, self, "From:") hbox.layout().addWidget(date_from) hbox = gui.hBox(lbox) gui.label(hbox, self, "To:") hbox.layout().addWidget(date_to) gui.radioButtons(box, self, 'data_granularity', btnLabels=[i.name.capitalize().replace('_', ' ') for i in DataGranularity], box='Resolution') self.button = gui.button(self.controlArea, self, 'Download', callback=self.download)
def __init__(self): super().__init__() self.data = None box = gui.widgetBox(self.controlArea, "Normalization") gui.radioButtons(box, self, "normalization_method", btnLabels=[x[0] for x in self.normalization_options], callback=self._invalidate) box = gui.widgetBox(self.controlArea, "Inversion") gui.radioButtons(box, self, "inversion_method", btnLabels=[x[0] for x in self.inversion_options], callback=self._invalidate) gui.auto_commit(self.controlArea, self, "autocommit", "Apply", checkbox_label="Apply on any change")
def __init__(self): super().__init__() self.data = None gui.radioButtons(self.controlArea, self, "axis", ["Rows", "Columns"], box="Distances between", callback=self._invalidate ) gui.comboBox(self.controlArea, self, "metric_idx", box="Distance Metric", items=list(zip(*_METRICS))[0], callback=self._invalidate ) box = gui.auto_commit(self.buttonsArea, self, "autocommit", "Apply", box=False, checkbox_label="Apply automatically") box.layout().insertWidget(0, self.report_button) box.layout().insertSpacing(1, 8) self.layout().setSizeConstraint(self.layout().SetFixedSize)
def __init__(self): super().__init__() self.data = None box = gui.widgetBox(self.controlArea, "Normalization") gui.radioButtons(box, self, "normalization_method", btnLabels=[x[0] for x in self.normalization_options], callback=self._invalidate) box = gui.widgetBox(self.controlArea, "Inversion") gui.radioButtons(box, self, "inversion_method", btnLabels=[x[0] for x in self.inversion_options], callback=self._invalidate) box = gui.widgetBox(self.controlArea, True, orientation="vertical") box = gui.auto_commit(self.controlArea, self, "autocommit", "Apply", checkbox_label="Apply on any change") gui.separator(box, 20) box.layout().addWidget(self.report_button)
def __init__(self): self.data = None box = gui.vBox(self.controlArea, 'Seasonal Adjustment') gui.spin(box, self, 'n_periods', 2, 1000, label='Season period:', callback=self.on_changed, tooltip='The expected length of full cycle. E.g., if you have ' 'monthly data and the apparent season repeats every ' 'year, you put in 12.') gui.radioButtons(box, self, 'decomposition', self.DECOMPOSITION_MODELS, label='Decomposition model:', orientation=Qt.Horizontal, callback=self.on_changed) self.view = view = QListView(self, selectionMode=QListView.ExtendedSelection) self.model = model = VariableListModel(parent=self) view.setModel(model) view.selectionModel().selectionChanged.connect(self.on_changed) box.layout().addWidget(view) gui.auto_commit(box, self, 'autocommit', '&Apply')
def _create_radio_parameter(self, name, label): self.__radio_parameter_update(name) values = (x[1] for x in getattr(self, name + "_values")) gui.separator(self.main_area) box = gui.hBox(self.main_area) lbl = gui.label(box, self, label + ":") rbt = gui.radioButtons( box, self, name + "_index", btnLabels=values, callback=lambda f=self.__radio_parameter_update, p=name: self.__parameter_changed(f, p)) rbt.layout().setAlignment(Qt.AlignTop) lbl.setAlignment(Qt.AlignTop) return rbt