Ejemplo n.º 1
0
    def _add_control_area_controls(self):
        box = gui.vBox(self.controlArea, box=True)
        gui.comboBox(box,
                     self,
                     "row_feature",
                     label="Rows",
                     contentsLength=12,
                     searchable=True,
                     model=DomainModel(valid_types=DomainModel.PRIMITIVE),
                     callback=self.__feature_changed)
        gui.comboBox(
            box,
            self,
            "col_feature",
            label="Columns",
            contentsLength=12,
            searchable=True,
            model=DomainModel(placeholder="(Same as rows)",
                              valid_types=DiscreteVariable),
            callback=self.__feature_changed,
        )
        gui.comboBox(box,
                     self,
                     "val_feature",
                     label="Values",
                     contentsLength=12,
                     searchable=True,
                     model=DomainModel(placeholder="(None)"),
                     callback=self.__val_feature_changed)
        self.__add_aggregation_controls()
        gui.rubber(self.controlArea)
        gui.auto_apply(self.controlArea, self, "auto_commit")

        self.set_input_summary()
        self.set_output_summary(None, None, None)
Ejemplo n.º 2
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.data_normalized = None
        self.db = None
        self.model = None

        box = gui.widgetBox(self.controlArea, "参数")
        gui.spin(box, self, "min_samples", 1, 100, 1,
                 callback=self._min_samples_changed,
                 label="核心店邻近数(Core point neighbors)")
        gui.doubleSpin(box, self, "eps", EPS_BOTTOM_LIMIT, 1000, 0.01,
                       callback=self._eps_changed,
                       label="临近点距离")

        box = gui.widgetBox(self.controlArea, self.tr("距离度量"))
        gui.comboBox(box, self, "metric_idx",
                     items=list(zip(*self.METRICS))[0],
                     callback=self._metirc_changed)

        gui.auto_apply(self.controlArea, self, "auto_commit")
        gui.rubber(self.controlArea)

        self.controlArea.layout().addStretch()

        self.plot = SliderGraph(
            x_axis_label="根据评分排序的数据",
            y_axis_label="到第 k 个最邻近点的距离",
            callback=self._on_cut_changed
        )

        self.mainArea.layout().addWidget(self.plot)
Ejemplo n.º 3
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.extra_data = None

        content = [
            INDEX, INSTANCEID,
            DomainModel.ATTRIBUTES, DomainModel.CLASSES, DomainModel.METAS]
        self.model = DomainModelWithTooltips(content)
        self.extra_model = DomainModelWithTooltips(content)

        box = gui.hBox(self.controlArea, box=None)
        no_info = self.data_info(None)
        self.info_box_data = gui.label(box, self, no_info, box="Data")
        self.info_box_extra_data = gui.label(box, self, no_info, box="Extra Data")

        grp = gui.radioButtons(
            self.controlArea, self, "merging", box="Merging",
            btnLabels=self.OptionNames, tooltips=self.OptionDescriptions,
            callback=self.change_merging)
        grp.layout().setSpacing(8)

        self.attr_boxes = ConditionBox(
            self, self.model, self.extra_model, "", "matches")
        self.attr_boxes.add_row()
        box = gui.vBox(self.controlArea, box="Row matching")
        box.layout().addWidget(self.attr_boxes)

        gui.auto_apply(self.controlArea, self, box=False)
        # connect after wrapping self.commit with gui.auto_commit!
        self.attr_boxes.vars_changed.connect(self.commit)
        self.attr_boxes.vars_changed.connect(self.store_combo_state)
        self.settingsAboutToBePacked.connect(self.store_combo_state)
Ejemplo n.º 4
0
    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")
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
 def _add_control_area_controls(self):
     gui.comboBox(gui.vBox(self.controlArea, box="Rows"),
                  self,
                  "row_feature",
                  contentsLength=14,
                  searchable=True,
                  model=DomainModel(valid_types=DomainModel.PRIMITIVE),
                  callback=self.__feature_changed,
                  orientation=Qt.Horizontal)
     gui.comboBox(gui.vBox(self.controlArea, box="Columns"),
                  self,
                  "col_feature",
                  contentsLength=14,
                  searchable=True,
                  model=DomainModel(placeholder="(Same as rows)",
                                    valid_types=DiscreteVariable),
                  callback=self.__feature_changed,
                  orientation=Qt.Horizontal)
     gui.comboBox(gui.vBox(self.controlArea, box="Values"),
                  self,
                  "val_feature",
                  contentsLength=14,
                  searchable=True,
                  model=DomainModel(placeholder="(None)"),
                  callback=self.__val_feature_changed,
                  orientation=Qt.Horizontal)
     self.__add_aggregation_controls()
     gui.rubber(self.controlArea)
     gui.auto_apply(self.buttonsArea, self, "auto_commit")
Ejemplo n.º 7
0
    def _init_ui(self):
        # implement your user interface here (for setting hyperparameters)
        gui.separator(self.controlArea)
        box = gui.widgetBox(self.controlArea, "Hyperparameter")

        gui.separator(self.controlArea)

        gui.lineEdit(
            box,
            self,
            "use_columns_buf",
            label=
            'Column index to use when use_semantic_types is activated. Tuple, e.g. (0,1,2)',
            validator=None,
            callback=self._use_columns_callback)

        gui.lineEdit(
            box,
            self,
            "exclude_columns_buf",
            label=
            'Column index to exclude when use_semantic_types is activated. Tuple, e.g. (0,1,2)',
            validator=None,
            callback=self._exclude_columns_callback)

        gui.auto_apply(box, self, "autosend", box=False)

        self.data = None
        self.info.set_input_summary(self.info.NoInput)
        self.info.set_output_summary(self.info.NoOutput)
Ejemplo n.º 8
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.extra_data = None

        content = [
            INDEX, INSTANCEID,
            DomainModel.ATTRIBUTES, DomainModel.CLASSES, DomainModel.METAS]
        self.model = DomainModelWithTooltips(content)
        self.extra_model = DomainModelWithTooltips(content)

        grp = gui.radioButtons(
            self.controlArea, self, "merging", box="合并",
            btnLabels=self.OptionNames, tooltips=self.OptionDescriptions,
            callback=self.change_merging)

        self.attr_boxes = ConditionBox(
            self, self.model, self.extra_model, "", "匹配")
        self.attr_boxes.add_row()
        self.attr_boxes.add_plus_row()
        box = gui.vBox(self.controlArea, box="行匹配")
        box.layout().addWidget(self.attr_boxes)

        gui.auto_apply(self.buttonsArea, self)

        self.attr_boxes.vars_changed.connect(self.commit.deferred)
        self.attr_boxes.vars_changed.connect(self.store_combo_state)
        self.settingsAboutToBePacked.connect(self.store_combo_state)
Ejemplo n.º 9
0
    def __init__(self):
        super().__init__()

        box = gui.vBox(self.controlArea, "分类特征")
        gui.radioButtonsInBox(
            box, self, "multinomial_treatment",
            btnLabels=[x[0] for x in self.multinomial_treats],
            callback=self.settings_changed)

        box = gui.vBox(self.controlArea, "数值特征")
        gui.radioButtonsInBox(
            box, self, "continuous_treatment",
            btnLabels=[x[0] for x in self.continuous_treats],
            callback=self.settings_changed)

        box = gui.vBox(self.controlArea, "分类目标")
        gui.radioButtonsInBox(
            box, self, "class_treatment",
            btnLabels=[t[0] for t in self.class_treats],
            callback=self.settings_changed)

        zbbox = gui.vBox(self.controlArea, "数值范围")

        gui.radioButtonsInBox(
            zbbox, self, "zero_based",
            btnLabels=self.value_ranges,
            callback=self.settings_changed)

        gui.auto_apply(self.buttonsArea, self, "autosend", box=False)

        self.data = None
        self.info.set_input_summary(self.info.NoInput)
        self.info.set_output_summary(self.info.NoOutput)
Ejemplo n.º 10
0
    def __init__(self):
        super().__init__()
        self.net = None
        self.cluster_feature = None

        box = gui.vBox(self.controlArea, "Label Propagation")
        gui.spin(box,
                 self,
                 "iterations",
                 1,
                 100000,
                 1,
                 label="Max. iterations: ",
                 callback=self.commit)
        gui.doubleSpin(box,
                       self,
                       "hop_attenuation",
                       0,
                       1,
                       0.01,
                       label="Apply hop attenuation: ",
                       checked="attenuate",
                       callback=self.commit)
        self.random_state = gui.checkBox(box,
                                         self,
                                         "use_random_state",
                                         label="Replicable clustering",
                                         callback=self.commit)

        gui.auto_apply(self.controlArea, self)
Ejemplo n.º 11
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.data_normalized = None
        self.db = None
        self.model = None

        box = gui.widgetBox(self.controlArea, "Parameters")
        gui.spin(box, self, "min_samples", 1, 100, 1,
                 callback=self._min_samples_changed,
                 label="Core point neighbors")
        gui.doubleSpin(box, self, "eps", EPS_BOTTOM_LIMIT, 1000, 0.01,
                       callback=self._eps_changed,
                       label="Neighborhood distance")

        box = gui.widgetBox(self.controlArea, self.tr("Distance Metric"))
        gui.comboBox(box, self, "metric_idx",
                     items=list(zip(*self.METRICS))[0],
                     callback=self._metirc_changed)
        gui.checkBox(box, self, "normalize", "Normalize features",
                     callback=self._on_normalize_changed)

        gui.auto_apply(self.buttonsArea, self, "auto_commit")
        gui.rubber(self.controlArea)

        self.controlArea.layout().addStretch()

        self.plot = SliderGraph(
            x_axis_label="Data items sorted by score",
            y_axis_label="Distance to the k-th nearest neighbour",
            callback=self._on_cut_changed
        )

        self.mainArea.layout().addWidget(self.plot)
Ejemplo n.º 12
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)
        self.data = None

        # self.apply is changed later, pylint: disable=unnecessary-lambda
        box = gui.radioButtons(
            self.controlArea, self, "feature_type", box="特征名称",
            callback=self.commit.deferred)

        button = gui.appendRadioButton(box, "通用")
        edit = gui.lineEdit(
            gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self,
            "feature_name",
            placeholderText="键入前缀 ...", toolTip="自定义特征名称")
        edit.editingFinished.connect(self._apply_editing)

        self.meta_button = gui.appendRadioButton(box, "从变量:")
        self.feature_model = DomainModel(
            valid_types=(ContinuousVariable, StringVariable),
            alphabetical=False)
        self.feature_combo = gui.comboBox(
            gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self,
            "feature_names_column", contentsLength=12, searchable=True,
            callback=self._feature_combo_changed, model=self.feature_model)

        self.remove_check = gui.checkBox(
            gui.indentedBox(box, gui.checkButtonOffsetHint(button)), self,
            "remove_redundant_inst", "删除冗余实例",
            callback=self.commit.deferred)

        gui.auto_apply(self.buttonsArea, self)

        self.set_controls()
Ejemplo n.º 13
0
 def _add_control_area_controls(self):
     box = gui.vBox(self.controlArea, "行")
     gui.comboBox(box,
                  self,
                  "row_feature",
                  contentsLength=12,
                  model=DomainModel(valid_types=DomainModel.PRIMITIVE),
                  callback=self.__feature_changed)
     box = gui.vBox(self.controlArea, "列")
     gui.comboBox(box,
                  self,
                  "col_feature",
                  contentsLength=12,
                  model=DomainModel(placeholder="(与行相同)",
                                    valid_types=DiscreteVariable),
                  callback=self.__feature_changed)
     box = gui.vBox(self.controlArea, "值")
     gui.comboBox(box,
                  self,
                  "val_feature",
                  contentsLength=12,
                  model=DomainModel(placeholder="(None)"),
                  orientation=Qt.Horizontal,
                  callback=self.__val_feature_changed)
     self.__add_aggregation_controls()
     gui.rubber(self.controlArea)
     gui.auto_apply(self.controlArea, self, "auto_commit")
Ejemplo n.º 14
0
    def __init__(self):
        super().__init__()

        box = gui.vBox(self.controlArea, "Categorical Features")
        gui.radioButtonsInBox(
            box,
            self,
            "multinomial_treatment",
            btnLabels=[x[0] for x in self.multinomial_treats],
            callback=self.settings_changed)

        box = gui.vBox(self.controlArea, "Numeric Features")
        gui.radioButtonsInBox(box,
                              self,
                              "continuous_treatment",
                              btnLabels=[x[0] for x in self.continuous_treats],
                              callback=self.settings_changed)

        box = gui.vBox(self.controlArea, "Categorical Outcome(s)")
        gui.radioButtonsInBox(box,
                              self,
                              "class_treatment",
                              btnLabels=[t[0] for t in self.class_treats],
                              callback=self.settings_changed)

        gui.auto_apply(self.buttonsArea, self, "autosend", box=False)

        self.data = None
        self.info.set_input_summary(self.info.NoInput)
        self.info.set_output_summary(self.info.NoOutput)
Ejemplo n.º 15
0
    def _add_control_area_controls(self):
        box = gui.vBox(self.controlArea, "Rows")
        gui.comboBox(box,
                     self,
                     "row_feature",
                     contentsLength=12,
                     model=DomainModel(valid_types=DomainModel.PRIMITIVE),
                     callback=self.__feature_changed)
        box = gui.vBox(self.controlArea, "Columns")
        gui.comboBox(box,
                     self,
                     "col_feature",
                     contentsLength=12,
                     model=DomainModel(placeholder="(Same as rows)",
                                       valid_types=DiscreteVariable),
                     callback=self.__feature_changed)
        box = gui.vBox(self.controlArea, "Values")
        gui.comboBox(box,
                     self,
                     "val_feature",
                     contentsLength=12,
                     model=DomainModel(placeholder="(None)"),
                     orientation=Qt.Horizontal,
                     callback=self.__val_feature_changed)
        self.__add_aggregation_controls()
        gui.rubber(self.controlArea)
        gui.auto_apply(self.controlArea, self, "auto_commit")

        self.info.set_input_summary(self.info.NoInput)
        self.info.set_output_summary(self.info.NoOutput)
Ejemplo n.º 16
0
    def __init__(self):
        super().__init__()
        self.data = None

        box = gui.vBox(self.controlArea, box=True)

        self.variable_model = DomainModel(
            order=DomainModel.MIXED, valid_types=(ContinuousVariable, ))
        var_list = gui.listView(
            box, self, "variables", model=self.variable_model,
            callback=self.commit.deferred
        )
        var_list.setSelectionMode(var_list.ExtendedSelection)

        combo = gui.comboBox(
            box, self, "operation",
            label="Operator: ", orientation=Qt.Horizontal,
            items=list(self.Operations), sendSelectedValue=True,
            callback=self.commit.deferred
        )
        combo.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed)

        gui.lineEdit(
            box, self, "var_name",
            label="Variable name: ", orientation=Qt.Horizontal,
            callback=self.commit.deferred
        )

        gui.auto_apply(self.controlArea, self)
Ejemplo n.º 17
0
    def __init__(self):
        super().__init__()
        self.data = None

        # GUI
        box = gui.hBox(self.controlArea, "Shuffled columns")
        box.layout().setSpacing(20)
        self.class_check = gui.checkBox(
            box, self, "shuffle_class", "Classes",
            callback=self._shuffle_check_changed)
        self.attrs_check = gui.checkBox(
            box, self, "shuffle_attrs", "Features",
            callback=self._shuffle_check_changed)
        self.metas_check = gui.checkBox(
            box, self, "shuffle_metas", "Metas",
            callback=self._shuffle_check_changed)

        box = gui.vBox(self.controlArea, "Shuffled rows")
        hbox = gui.hBox(box)
        gui.widgetLabel(hbox, "None")
        self.scope_slider = gui.hSlider(
            hbox, self, "scope_prop", minValue=0, maxValue=100, width=140,
            createLabel=False, callback=self._scope_slider_changed)
        gui.widgetLabel(hbox, "All")
        self.scope_label = gui.widgetLabel(
            box, "", alignment=Qt.AlignCenter,
            sizePolicy=(QSizePolicy.MinimumExpanding, QSizePolicy.Fixed))
        self._set_scope_label()
        self.replicable_check = gui.checkBox(
            box, self, "random_seed", "Replicable shuffling",
            callback=self._shuffle_check_changed)

        gui.auto_apply(self.buttonsArea, self, commit=self.apply)
    def _init_ui(self):
        # implement your user interface here (for setting hyperparameters)
        # layout = QGridLayout()
        # gui.widgetBox(self.controlArea, orientation=layout)

        # ac = gui.auto_apply(None, self, "autosend", box=False)
        # layout.addWidget(ac, 1, 2)

        # # print_hyperparameter = gui.button(self.buttonsArea, self, "Print Hyperparameters",
        # #            callback=self._print_hyperparameter)

        # # layout.addWidget(print_hyperparameter, 1, 0)

        # layout.addWidget(gui.widgetLabel(None, "interval: "), 2, 0, Qt.AlignLeft)
        # sb = gui.hBox(None, margin=0)
        # layout.addWidget(sb, 2, 1)
        # gui.lineEdit(
        #     sb, self, "interval", controlWidth=60, valueType=int,
        #     callback=None)

        # layout.addWidget(gui.comboBox(
        #     None, self, "continuity_option", items=['ablation', 'imputation'],
        #     orientation=Qt.Horizontal, # callback=self._correlation_combo_changed
        # ), 3, 0)

        ######
        gui.separator(self.controlArea)
        box = gui.widgetBox(self.controlArea, "Hyperparameter")
        # self.infoa = gui.widgetLabel(
        #     box, "Choose ablation or imputation the original data"
        # )

        gui.separator(self.controlArea)

        gui.lineEdit(box,
                     self,
                     "interval",
                     label='interval',
                     valueType=float,
                     callback=None)

        gui.comboBox(
            box,
            self,
            "continuity_option",
            label='continuity_option',
            items=['ablation', 'imputation'],
            orientation=Qt.
            Horizontal,  # callback=self._correlation_combo_changed
        )

        gui.auto_apply(box, self, "autosend", box=False)

        ######
        self.data = None
        self.info.set_input_summary(self.info.NoInput)
        self.info.set_output_summary(self.info.NoOutput)
Ejemplo n.º 19
0
    def init_gui(self):
        box = gui.vBox(self.controlArea, "Method")
        self.method_combo = gui.comboBox(box, self, "outlier_method",
                                         items=[m.name for m in self.METHODS],
                                         callback=self.__method_changed)

        self._init_editors()

        gui.auto_apply(self.buttonsArea, self, "auto_commit")
Ejemplo n.º 20
0
    def _init_ui(self):
        # implement your user interface here (for setting hyperparameters)
        gui.separator(self.controlArea)
        box = gui.widgetBox(self.controlArea, "Hyperparameter")

        gui.separator(self.controlArea)

        gui.lineEdit(box,
                     self,
                     "semantic_types_buf",
                     label='semantic_types_buf',
                     callback=self._semantic_types_callback)

        gui.comboBox(box,
                     self,
                     "match_logic",
                     label='Output match_logic.',
                     items=['all', 'any', 'equal'],
                     sendSelectedValue=True,
                     callback=self.settings_changed)

        gui.checkBox(box,
                     self,
                     "negate",
                     label='negate',
                     callback=self.settings_changed)

        gui.lineEdit(
            box,
            self,
            "use_columns_buf",
            label=
            'Column index to use when use_semantic_types is activated. Tuple, e.g. (0,1,2)',
            validator=None,
            callback=self._use_columns_callback)

        gui.lineEdit(
            box,
            self,
            "exclude_columns_buf",
            label=
            'Column index to exclude when use_semantic_types is activated. Tuple, e.g. (0,1,2)',
            validator=None,
            callback=self._exclude_columns_callback)

        gui.checkBox(box,
                     self,
                     "add_index_columns",
                     label='Keep index in the outputs.',
                     callback=self.settings_changed)

        gui.auto_apply(box, self, "autosend", box=False)

        self.data = None
        self.info.set_input_summary(self.info.NoInput)
        self.info.set_output_summary(self.info.NoOutput)
Ejemplo n.º 21
0
    def __init__(self):
        super().__init__()
        self.data = None

        self._pca = None
        self._transformed = None
        self._variance_ratio = None
        self._cumulative = None
        self._init_projector()

        # Components Selection
        box = gui.vBox(self.controlArea, "Components Selection")
        form = QFormLayout()
        box.layout().addLayout(form)

        self.components_spin = gui.spin(
            box, self, "ncomponents", 1, MAX_COMPONENTS,
            callback=self._update_selection_component_spin,
            keyboardTracking=False
        )
        self.components_spin.setSpecialValueText("All")

        self.variance_spin = gui.spin(
            box, self, "variance_covered", 1, 100,
            callback=self._update_selection_variance_spin,
            keyboardTracking=False
        )
        self.variance_spin.setSuffix("%")

        form.addRow("Components:", self.components_spin)
        form.addRow("Explained variance:", self.variance_spin)

        # Options
        self.options_box = gui.vBox(self.controlArea, "Options")
        self.normalize_box = gui.checkBox(
            self.options_box, self, "normalize",
            "Normalize variables", callback=self._update_normalize
        )

        self.maxp_spin = gui.spin(
            self.options_box, self, "maxp", 1, MAX_COMPONENTS,
            label="Show only first", callback=self._setup_plot,
            keyboardTracking=False
        )

        self.controlArea.layout().addStretch()

        gui.auto_apply(self.controlArea, self, "auto_commit")

        self.plot = SliderGraph(
            "Principal Components", "Proportion of variance",
            self._on_cut_changed)

        self.mainArea.layout().addWidget(self.plot)
        self._update_normalize()
Ejemplo n.º 22
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.results = None
        self.learners = []
        self.headers = []

        self.learners_box = gui.listBox(
            self.controlArea, self, "selected_learner", "learners", box=True,
            callback=self._learner_changed
        )

        self.outputbox = gui.vBox(self.controlArea, "Output")
        box = gui.hBox(self.outputbox)
        gui.checkBox(box, self, "append_predictions",
                     "Predictions", callback=self._invalidate)
        gui.checkBox(box, self, "append_probabilities",
                     "Probabilities",
                     callback=self._invalidate)

        gui.auto_apply(self.outputbox, self, "autocommit", box=False)

        self.mainArea.layout().setContentsMargins(0, 0, 0, 0)

        box = gui.vBox(self.mainArea, box=True)

        sbox = gui.hBox(box)
        gui.rubber(sbox)
        gui.comboBox(sbox, self, "selected_quantity",
                     items=self.quantities, label="Show: ",
                     orientation=Qt.Horizontal, callback=self._update)

        self.tablemodel = QStandardItemModel(self)
        view = self.tableview = QTableView(
            editTriggers=QTableView.NoEditTriggers)
        view.setModel(self.tablemodel)
        view.horizontalHeader().hide()
        view.verticalHeader().hide()
        view.horizontalHeader().setMinimumSectionSize(60)
        view.selectionModel().selectionChanged.connect(self._invalidate)
        view.setShowGrid(False)
        view.setItemDelegate(BorderedItemDelegate(Qt.white))
        view.setSizePolicy(QSizePolicy.MinimumExpanding,
                           QSizePolicy.MinimumExpanding)
        view.clicked.connect(self.cell_clicked)
        box.layout().addWidget(view)

        selbox = gui.hBox(box)
        gui.button(selbox, self, "Select Correct",
                   callback=self.select_correct, autoDefault=False)
        gui.button(selbox, self, "Select Misclassified",
                   callback=self.select_wrong, autoDefault=False)
        gui.button(selbox, self, "Clear Selection",
                   callback=self.select_none, autoDefault=False)
Ejemplo n.º 23
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.data: Optional[Table] = None
        self._output_desc: Optional[Dict[str, str]] = None

        box = gui.widgetBox(self.controlArea, "Unique Row Identifier")
        self.idvar_model = itemmodels.VariableListModel(
            [None], placeholder="Row number")
        self.var_cb = gui.comboBox(
            box,
            self,
            "idvar",
            model=self.idvar_model,
            callback=self._invalidate,
            minimumContentsLength=16,
            tooltip="A column with identifier, like customer's id")

        box = gui.widgetBox(self.controlArea, "Filter")
        gui.checkBox(box,
                     self,
                     "only_numeric",
                     "Ignore non-numeric features",
                     callback=self._invalidate)
        gui.checkBox(
            box,
            self,
            "exclude_zeros",
            "Exclude zero values",
            callback=self._invalidate,
            tooltip="Besides missing values, also omit items with zero values")

        form = QFormLayout()
        gui.widgetBox(self.controlArea,
                      "Names for generated features",
                      orientation=form)
        form.addRow(
            "Item:",
            gui.lineEdit(None,
                         self,
                         "item_var_name",
                         callback=self._invalidate,
                         placeholderText=DEFAULT_ITEM_NAME,
                         styleSheet="padding-left: 3px"))
        form.addRow(
            "Value:",
            gui.lineEdit(None,
                         self,
                         "value_var_name",
                         callback=self._invalidate,
                         placeholderText=DEFAULT_VALUE_NAME,
                         styleSheet="padding-left: 3px"))

        gui.auto_apply(self.controlArea, self)
Ejemplo n.º 24
0
    def init_gui(self):
        box = gui.vBox(self.controlArea, "Method")
        self.method_combo = gui.comboBox(box, self, "outlier_method",
                                         items=[m.name for m in self.METHODS],
                                         callback=self.__method_changed)

        self._init_editors()

        gui.auto_apply(self.controlArea, self, "auto_commit")

        self.info.set_input_summary(self.info.NoInput)
        self.info.set_output_summary(self.info.NoOutput)
Ejemplo n.º 25
0
    def __init__(self):
        super().__init__()
        self.data: Optional[Table] = None
        self.reference: Optional[Table] = None

        self.filter_edit = QLineEdit(textChanged=self.__filter_edit_changed,
                                     placeholderText="Filter...")
        self.view = QTableView(sortingEnabled=True,
                               contextMenuPolicy=Qt.CustomContextMenu,
                               selectionMode=QTableView.NoSelection)
        self.view.customContextMenuRequested.connect(self.__menu_requested)
        self.view.setItemDelegateForColumn(self.Header.variable,
                                           VariableDelegate(self))
        self.view.verticalHeader().hide()
        self.view.horizontalHeader().setStretchLastSection(True)
        self.view.horizontalHeader().setMaximumSectionSize(350)

        self.model = VariableItemModel(self)
        self.model.setHorizontalHeaderLabels([x for _, x in self.HEADER])
        self.model.dataChanged.connect(self.__table_data_changed)
        self.model.dataHasNanColumn.connect(self.Information.nans_removed)
        self.proxy_model = QSortFilterProxyModel()
        self.proxy_model.setFilterKeyColumn(-1)
        self.proxy_model.setFilterCaseSensitivity(Qt.CaseInsensitive)
        self.proxy_model.setSourceModel(self.model)
        self.view.setModel(self.proxy_model)

        vbox = gui.vBox(self.controlArea, box=True)
        vbox.layout().addWidget(self.filter_edit)
        vbox.layout().addWidget(self.view)

        box = gui.hBox(vbox, objectName="buttonBox")
        gui.rubber(box)
        for name in self.ACTIONS:
            gui.button(box,
                       self,
                       name.capitalize(),
                       lambda *args, fun=name: self._initialize_values(fun),
                       autoDefault=False)
        gui.rubber(box)

        gui.checkBox(self.buttonsArea,
                     self,
                     "append_to_data",
                     "Append this instance to input data",
                     callback=self.commit.deferred)
        gui.rubber(self.buttonsArea)
        gui.auto_apply(self.buttonsArea, self, "auto_commit")

        self.settingsAboutToBePacked.connect(self.pack_settings)
Ejemplo n.º 26
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.reference = None
        self.distances = None

        box = gui.vBox(self.controlArea, box=True)
        gui.comboBox(box,
                     self,
                     "distance_index",
                     orientation=Qt.Horizontal,
                     label="距离: ",
                     items=[d[0] for d in METRICS],
                     callback=self.recompute)
        gui.spin(box,
                 self,
                 "n_neighbors",
                 label="邻居数:",
                 step=1,
                 spinType=int,
                 minv=0,
                 maxv=100,
                 callback=self.apply)
        gui.checkBox(box,
                     self,
                     "exclude_reference",
                     label="排除(等于)参考的行(Exclude rows (equal to) references)",
                     callback=self.apply)

        self.apply_button = gui.auto_apply(self.controlArea,
                                           self,
                                           commit=self.apply)
        self.info.set_input_summary(self.info.NoInput)
        self.info.set_output_summary(self.info.NoOutput)
Ejemplo n.º 27
0
    def __init__(self):
        self.data = None

        # GUI
        method_box = gui.vBox(self.controlArea, "方法")
        self.manifold_methods_combo = gui.comboBox(
            method_box, self, "manifold_method_index",
            items=[m.name for m in self.MANIFOLD_METHODS],
            callback=self.manifold_method_changed)

        self.params_box = gui.vBox(self.controlArea, "参数")

        self.tsne_editor = TSNEParametersEditor(self)
        self.mds_editor = MDSParametersEditor(self)
        self.isomap_editor = IsomapParametersEditor(self)
        self.lle_editor = LocallyLinearEmbeddingParametersEditor(self)
        self.spectral_editor = SpectralEmbeddingParametersEditor(self)
        self.parameter_editors = [
            self.tsne_editor, self.mds_editor, self.isomap_editor,
            self.lle_editor, self.spectral_editor]

        for editor in self.parameter_editors:
            self.params_box.layout().addWidget(editor)
            editor.hide()
        self.params_widget = self.parameter_editors[self.manifold_method_index]
        self.params_widget.show()

        output_box = gui.vBox(self.controlArea, "输出")
        self.n_components_spin = gui.spin(
            output_box, self, "n_components", 1, 10, label="成分:",
            alignment=Qt.AlignRight, callbackOnReturn=True,
            callback=self.settings_changed)
        self.apply_button = gui.auto_apply(self.controlArea, self, box=False, commit=self.apply)
Ejemplo n.º 28
0
    def __init__(self):
        super().__init__()
        self.data = None
        self.orig_domain = self.domain = None

        box = gui.hBox(self.controlArea, "Discrete Variables")
        self.disc_model = DiscColorTableModel()
        self.disc_view = DiscreteTable(self.disc_model)
        self.disc_model.dataChanged.connect(self._on_data_changed)
        box.layout().addWidget(self.disc_view)

        box = gui.hBox(self.controlArea, "Numeric Variables")
        self.cont_model = ContColorTableModel()
        self.cont_view = ContinuousTable(self.cont_model)
        self.cont_model.dataChanged.connect(self._on_data_changed)
        box.layout().addWidget(self.cont_view)

        box = gui.auto_apply(self.controlArea, self, "auto_apply")
        box.button.setFixedWidth(180)
        save = gui.button(None, self, "Save", callback=self.save)
        load = gui.button(None, self, "Load", callback=self.load)
        reset = gui.button(None, self, "Reset", callback=self.reset)
        box.layout().insertWidget(0, save)
        box.layout().insertWidget(0, load)
        box.layout().insertWidget(2, reset)
        box.layout().insertStretch(3)

        self.info.set_input_summary(self.info.NoInput)
        self.info.set_output_summary(self.info.NoOutput)
Ejemplo n.º 29
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.reference = None
        self.distances = None

        box = gui.vBox(self.controlArea, box=True)
        gui.comboBox(box,
                     self,
                     "distance_index",
                     orientation=Qt.Horizontal,
                     label="Distance metric: ",
                     items=[d[0] for d in METRICS],
                     callback=self.recompute)
        gui.spin(
            box,
            self,
            "n_neighbors",
            label="Limit number of neighbors to:",
            step=1,
            spinType=int,
            minv=0,
            maxv=100,
            checked='limit_neighbors',
            # call apply by gui.auto_commit, pylint: disable=unnecessary-lambda
            checkCallback=lambda: self.apply(),
            callback=lambda: self.apply())

        self.apply_button = gui.auto_apply(self.controlArea,
                                           self,
                                           commit=self.apply)
        self.info.set_input_summary(self.info.NoInput)
        self.info.set_output_summary(self.info.NoOutput)
Ejemplo n.º 30
0
    def __init__(self):
        self.data = None

        # GUI
        method_box = gui.vBox(self.controlArea, "Method")
        self.manifold_methods_combo = gui.comboBox(
            method_box, self, "manifold_method_index",
            items=[m.name for m in self.MANIFOLD_METHODS],
            callback=self.manifold_method_changed)

        self.params_box = gui.vBox(method_box)

        self.tsne_editor = TSNEParametersEditor(self)
        self.mds_editor = MDSParametersEditor(self)
        self.isomap_editor = IsomapParametersEditor(self)
        self.lle_editor = LocallyLinearEmbeddingParametersEditor(self)
        self.spectral_editor = SpectralEmbeddingParametersEditor(self)
        self.parameter_editors = [
            self.tsne_editor, self.mds_editor, self.isomap_editor,
            self.lle_editor, self.spectral_editor]

        for editor in self.parameter_editors:
            self.params_box.layout().addWidget(editor)
            editor.hide()
        self.params_widget = self.parameter_editors[self.manifold_method_index]
        self.params_widget.show()

        output_box = gui.vBox(self.controlArea, "Output")
        self.n_components_spin = gui.spin(
            output_box, self, "n_components", 1, 10, label="Components:",
            controlWidth=QFontMetrics(self.font()).horizontalAdvance("0" * 10),
            alignment=Qt.AlignRight, callbackOnReturn=True,
            callback=self.settings_changed)
        gui.rubber(self.n_components_spin.box)
        self.apply_button = gui.auto_apply(self.buttonsArea, self)