Пример #1
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        ConcurrentWidgetMixin.__init__(self)
        self.data: Optional[Table] = None
        self.learner: CoxRegressionLearner = CoxRegressionLearner()

        self.stratify_on_options = [
            (StratifyOn.CoxRiskScore, 'Cox Risk Score'),
        ]

        self.splitting_criteria_options = [
            (SplittingCriteria.Median, 'Median'),
            (SplittingCriteria.Mean, 'Mean'),
            (SplittingCriteria.LogRankTest, 'Log Rank Test'),
        ]

        box = gui.vBox(self.controlArea, 'Stratify on', margin=0)
        gui.comboBox(
            box,
            self,
            'stratify_on',
            items=(label for _, label in self.stratify_on_options),
            callback=self.commit.deferred,
        )

        box = gui.vBox(self.controlArea, 'Splitting Criteria', margin=0)
        self.radio_buttons = gui.radioButtons(box, self, 'splitting_criteria', callback=self.commit.deferred)

        for _, opt in self.splitting_criteria_options:
            gui.appendRadioButton(self.radio_buttons, opt)

        self.commit_button = gui.auto_commit(self.controlArea, self, 'auto_commit', '&Commit', box=False)
Пример #2
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)
Пример #3
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()
Пример #4
0
    def __init__(self):
        super().__init__()
        ConcurrentWidgetMixin.__init__(self)

        self.corpus = None  # Corpus
        self.n_matching = ''  # Info on docs matching the word
        self.n_tokens = ''  # Info on tokens
        self.n_types = ''  # Info on types (unique tokens)
        self.is_word_on_input = False

        # Info attributes
        info_box = gui.widgetBox(self.controlArea, 'Info')
        gui.label(info_box, self, 'Tokens: %(n_tokens)s')
        gui.label(info_box, self, 'Types: %(n_types)s')
        gui.label(info_box, self, 'Matching: %(n_matching)s')

        # Width parameter
        gui.spin(self.controlArea,
                 self,
                 'context_width',
                 3,
                 10,
                 box=True,
                 label="Number of words:",
                 callback=self.set_width)

        gui.rubber(self.controlArea)

        # Search
        c_box = gui.widgetBox(self.mainArea, orientation=Qt.Horizontal)
        self.input = gui.lineEdit(c_box,
                                  self,
                                  'word',
                                  orientation=Qt.Horizontal,
                                  sizePolicy=QSizePolicy(
                                      QSizePolicy.MinimumExpanding,
                                      QSizePolicy.Fixed),
                                  label='Query:',
                                  callback=self.set_word,
                                  callbackOnType=True)
        self.input.setFocus()

        # Concordances view
        self.conc_view = QTableView()
        self.model = ConcordanceModel()
        self.conc_view.setModel(self.model)
        self.conc_view.setWordWrap(False)
        self.conc_view.setSelectionBehavior(QTableView.SelectRows)
        self.conc_view.setSelectionModel(DocumentSelectionModel(self.model))
        self.conc_view.setItemDelegate(HorizontalGridDelegate())
        self.conc_view.selectionModel().selectionChanged.connect(
            self.selection_changed)
        self.conc_view.horizontalHeader().hide()
        self.conc_view.setShowGrid(False)
        self.mainArea.layout().addWidget(self.conc_view)
        self.set_width()

        # Auto-commit box
        gui.auto_commit(self.controlArea, self, 'autocommit', 'Commit',
                        'Auto commit is on')
Пример #5
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)
        self.corpus = None
        self.last_config = None     # to avoid reruns with the same params
        self.strings_attrs = []
        self.profiler = TweetProfiler(on_server_down=self.Error.server_down)

        # Settings
        self.controlArea.layout().addWidget(self.generate_grid_layout())

        # Auto commit
        buttons_layout = QHBoxLayout()
        buttons_layout.addSpacing(15)
        buttons_layout.addWidget(
            gui.auto_commit(None, self, 'auto_commit', 'Commit', box=False)
        )
        self.controlArea.layout().addLayout(buttons_layout)

        self.cancel_button = QPushButton(
            'Cancel',
            icon=self.style()
            .standardIcon(QStyle.SP_DialogCancelButton))

        self.cancel_button.clicked.connect(self.cancel)

        hbox = gui.hBox(self.controlArea)
        hbox.layout().addWidget(self.cancel_button)
        self.cancel_button.setDisabled(True)
Пример #6
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)

        # self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)

        self.vc = cv.VideoCapture(0)
        self.vc.set(3, 640)  # set width
        self.vc.set(4, 480)  # set height

        self.image_label = QLabel()
        # self.image_label.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored)
        self.controlArea.layout().addWidget(self.image_label)
        # self.resize(pixmap.width(), pixmap.height())
        #
        # self.frame_timer = QTimer()
        # self.frame_timer.timeout.connect(self.update_frame)
        # self.frame_timer.start(0)
        #
        # self.output_timer = QTimer()
        # self.output_timer.timeout.connect(self.commit)
        # self.output_timer.start(0)

        # self.current_frame = None
        self.start(self.worker)
        self.setBlocking(False)
Пример #7
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")
Пример #8
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)

        self.corpus = None

        # Browse file box
        fbox = gui.widgetBox(self.controlArea, "语料库文件", orientation=0)
        self.file_widget = widgets.FileWidget(
            recent_files=self.recent_files, icon_size=(16, 16),
            on_open=self.open_file, dialog_format=self.dlgFormats,
            dialog_title='打开橙现智能文档语料库',
            reload_label='重载', browse_label='浏览',
            allow_empty=False, minimal_width=250,
        )
        fbox.layout().addWidget(self.file_widget)

        # dropdown to select title variable
        self.title_model = DomainModel(
            valid_types=(StringVariable,), placeholder="(无标题)")
        gui.comboBox(
            self.controlArea, self, "title_variable",
            box="标题变量", model=self.title_model,
            callback=self.update_feature_selection
        )

        # Used Text Features
        fbox = gui.widgetBox(self.controlArea, orientation=0)
        ubox = gui.widgetBox(fbox, "使用的文本特征", addSpace=False)
        self.used_attrs_model = VariableListModel(enable_dnd=True)
        self.used_attrs_view = VariablesListItemView()
        self.used_attrs_view.setModel(self.used_attrs_model)
        ubox.layout().addWidget(self.used_attrs_view)

        aa = self.used_attrs_model
        aa.dataChanged.connect(self.update_feature_selection)
        aa.rowsInserted.connect(self.update_feature_selection)
        aa.rowsRemoved.connect(self.update_feature_selection)

        # Ignored Text Features
        ibox = gui.widgetBox(fbox, "忽略的文本特征", addSpace=False)
        self.unused_attrs_model = VariableListModel(enable_dnd=True)
        self.unused_attrs_view = VariablesListItemView()
        self.unused_attrs_view.setModel(self.unused_attrs_model)
        ibox.layout().addWidget(self.unused_attrs_view)

        # Documentation Data Sets & Report
        box = gui.hBox(self.controlArea)
        self.browse_documentation = gui.button(
            box, self, "浏览文档语料库",
            callback=lambda: self.file_widget.browse(
                get_sample_corpora_dir()),
            autoDefault=False,
        )

        # load first file
        self.file_widget.select(0)
        self.update_output_info()
        self.update_input_info(None)
Пример #9
0
 def __init__(self):
     ConcurrentWidgetMixin.__init__(self)
     Orange.widgets.data.owpreprocess.OWPreprocess.__init__(self)
     box = gui.vBox(self.controlArea, "预览")
     self.preview = ""
     gui.label(box, self, "%(preview)s", wordWrap=True)
     self.controlArea.layout().insertWidget(1, box)
     self.controlArea.setFixedWidth(220)
Пример #10
0
 def __init__(self):
     OWDataProjectionWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)
     self.pca_projection = None  # type: Optional[Table]
     self.initialization = None  # type: Optional[np.ndarray]
     self.affinities = None      # type: Optional[openTSNE.affinity.Affinities]
     self.tsne_embedding = None  # type: Optional[manifold.TSNEModel]
     self.iterations_done = 0    # type: int
Пример #11
0
 def __init__(self):
     OWWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)
     self.corpus: Optional[Corpus] = None
     self.words: Optional[List] = None
     self._results: Optional[Results] = None
     self.__pending_selection = self.selection
     self._setup_gui()
Пример #12
0
 def __init__(self):
     OWDataProjectionWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)
     self.pca_projection = None  # type: Optional[Table]
     self.initialization = None  # type: Optional[np.ndarray]
     self.affinities = None      # type: Optional[openTSNE.affinity.Affinities]
     self.tsne_embedding = None  # type: Optional[manifold.TSNEModel]
     self.iterations_done = 0    # type: int
Пример #13
0
 def __init__(self):
     OWWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)
     self.corpus: Optional[Corpus] = None
     self.words: Optional[List] = None
     self.__cached_keywords = {}
     self.model = KeywordsTableModel(parent=self)
     self._setup_gui()
Пример #14
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)

        dynamic_canvas = FigureCanvas(Figure(figsize=(5, 3)))
        self._dynamic_ax = dynamic_canvas.figure.subplots()
        self._dynamic_ax.axis('off')
        self.controlArea.layout().addWidget(dynamic_canvas)
Пример #15
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)

        self.aggregators = AGGREGATORS
        self.corpus = None
        self.new_corpus = None
        self._setup_layout()
Пример #16
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)

        self.languages = list(LANGS_TO_ISO.keys())
        self.aggregators = AGGREGATORS
        self.corpus = None
        self.new_corpus = None
        self._setup_layout()
Пример #17
0
 def __init__(self):
     OWWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)
     self._setup_control_area()
     self._setup_main_area()
     self.corpus = None
     self.words = None
     # saves scores avoid multiple computation of the same score
     self.scores = {}
Пример #18
0
 def __init__(self):
     OWWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)
     self.__results = None  # type: Optional[Results]
     self.data = None  # type: Optional[Table]
     self.model = None  # type: Optional[Model]
     self._violin_plot = None  # type: Optional[ViolinPlot]
     self.setup_gui()
     self.__pending_selection = self.selection
Пример #19
0
 def __init__(self):
     self.dbscan_box: QWidget = None
     self.gmm_box: QWidget = None
     self.var_box: QWidget = None
     OWDataProjectionWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)
     self.clusters: Optional[_Clusters] = None
     self.enable_controls()
     self._invalidate_clusters()
Пример #20
0
 def __init__(self):
     OWWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)
     self.data = None  # type: Table
     self.n_inliers = None  # type: int
     self.n_outliers = None  # type: int
     self.editors = None  # type: Tuple[ParametersEditor]
     self.current_editor = None  # type: ParametersEditor
     self.method_combo = None  # type: QComboBox
     self.init_gui()
Пример #21
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)

        self.embedders = sorted(list(EMBEDDERS_INFO),
                                key=lambda k: EMBEDDERS_INFO[k]["order"])
        self._image_attributes = None
        self._input_data = None
        self._log = logging.getLogger(__name__)
        self._task = None
        self._setup_layout()
Пример #22
0
 def __init__(self):
     OWWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)
     self.__results = None  # type: Optional[Results]
     self.model = None  # type: Optional[Model]
     self.background_data = None  # type: Optional[Table]
     self.data = None  # type: Optional[Table]
     self._stripe_plot = None  # type: Optional[StripePlot]
     self.mo_info = ""
     self.bv_info = ""
     self.setup_gui()
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)

        self._corpus_to_network = None
        self.corpus = None
        self.node_types = ["Document", "Word"]
        self._task_state = "waiting"
        self._setup_layout()
        if Network is None:
            self.Error.no_network_addon()
Пример #24
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)
        self.__results = None  # type: Optional[Results]
        self.data = None  # type: Optional[Table]
        self.model = None  # type: Optional[Model]
        self._violin_plot = None  # type: Optional[ViolinPlot]
        self.setup_gui()
        self.__pending_selection = self.selection

        initial = ViolinPlot().parameter_setter.initial_settings
        VisualSettingsDialog(self, initial)
Пример #25
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)

        # Init data
        self.data = None
        self.selected_data = None
        # used for transforming the 'selected data' into the 'data' domain
        self.selected_data_transformed = None

        self.results = Result()

        # info box
        fbox = gui.widgetBox(self.controlArea, "Info")
        self.info_fil = gui.label(fbox, self, 'Words displayed: 0')

        # Filtering settings
        fbox = gui.widgetBox(self.controlArea, "Filter")
        hbox = gui.widgetBox(fbox, orientation=0)

        self.chb_p = gui.checkBox(hbox, self, "filter_by_p", "p-value",
                                  callback=self.filter_and_display,
                                  tooltip="Filter by word p-value")
        self.spin_p = gui.doubleSpin(hbox, self, 'filter_p_value',
                                     1e-4, 1, step=1e-4, labelWidth=15,
                                     callback=self.filter_and_display,
                                     tooltip="Max p-value for word")
        self.spin_p.setEnabled(self.filter_by_p)

        hbox = gui.widgetBox(fbox, orientation=0)
        self.chb_fdr = gui.checkBox(hbox, self, "filter_by_fdr", "FDR",
                                    callback=self.filter_and_display,
                                    tooltip="Filter by word FDR")
        self.spin_fdr = gui.doubleSpin(hbox, self, 'filter_fdr_value',
                                       1e-4, 1, step=1e-4, labelWidth=15,
                                       callback=self.filter_and_display,
                                       tooltip="Max p-value for word")
        self.spin_fdr.setEnabled(self.filter_by_fdr)
        gui.rubber(self.controlArea)

        gui.auto_send(self.buttonsArea, self, "auto_apply")

        # Word's list view
        self.cols = ['Word', 'p-value', 'FDR']
        self.sig_words = QTreeWidget()
        self.sig_words.setColumnCount(len(self.cols))
        self.sig_words.setHeaderLabels(self.cols)
        self.sig_words.setSortingEnabled(True)
        self.sig_words.setSelectionMode(QTreeView.NoSelection)
        self.sig_words.sortByColumn(1, 0)   # 0 is ascending order
        for i in range(len(self.cols)):
            self.sig_words.resizeColumnToContents(i)
        self.mainArea.layout().addWidget(self.sig_words)
Пример #26
0
 def __init__(self):
     OWDataProjectionWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)
     # inputs
     self.reference_data = None  # type: Optional[Table]
     self.secondary_data = None  # type: Optional[Table]
     self.genes = None  # type: Optional[Table]
     # annotations
     self.scores = None  # type: OWAnnotateProjection.Scores
     self.clusters = None  # type: OWAnnotateProjection.Clusters
     self.__invalidate_scores()
     self.__invalidate_clusters()
Пример #27
0
    def __init__(self):
        super().__init__()
        ConcurrentWidgetMixin.__init__(self)

        self.data = None
        self.result = None

        self.gb_attrs_model = DomainModel(separators=False, )
        self.agg_table_model = VarTableModel(self)
        self.agg_checkboxes = {}

        self.__init_control_area()
        self.__init_main_area()
Пример #28
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)

        self.frame = None

        self.animation = BouncingBalls()
        self.timer = QTimer()
        self.timer.timeout.connect(self.pygame_loop)
        self.timer.start(10)

        self.image = None
        self.current_colors = None
Пример #29
0
    def __init__(self) -> None:
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)
        self.corpus = None

        # the list with combos from the widget
        self.combos = []
        # the list with line edits from the widget
        self.line_edits = []
        # the list of buttons in front of controls that removes them
        self.remove_buttons = []

        self._init_controls()
Пример #30
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)
        self.results: Optional[BaseResults] = None
        self.data: Optional[Table] = None
        self.model: Optional[Model] = None
        self.plot: Optional[FeaturesPlot] = None
        self.scene: Optional[GraphicsScene] = None
        self.view: Optional[GraphicsView] = None
        self.setup_gui()
        self.__pending_selection = self.selection

        initial = self.PLOT_CLASS().parameter_setter.initial_settings
        VisualSettingsDialog(self, initial)
Пример #31
0
    def __init__(self):
        OWWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)
        self.data = None
        self.selected_attributes = None
        box = gui.vBox(self.controlArea, "Granger Test")
        gui.hSlider(
            box,
            self,
            "confidence",
            minValue=90,
            maxValue=99,
            label="Confidence:",
            labelFormat=" %d%%",
            callback=self._setting_changed,
        )
        gui.spin(
            box,
            self,
            "max_lag",
            1,
            50,
            label="Max lag:",
            callback=self._setting_changed,
        )
        self.test_button = gui.button(box, self, "&Test", self._toggle_run)
        gui.rubber(self.controlArea)

        self.model = model = PyTableModel(parent=self)

        model.setHorizontalHeaderLabels(COLUMNS)
        self.causality_view = view = gui.TableView(self)
        view.setModel(model)
        bold = view.BoldFontDelegate(self)
        view.setItemDelegateForColumn(2, bold)
        view.setItemDelegateForColumn(4, bold)
        view.horizontalHeader().setStretchLastSection(False)
        view.horizontalHeader().sectionClicked.connect(self.header_click)
        view.selectionModel().selectionChanged.connect(self.on_select)
        view.sortByColumn(1, Qt.AscendingOrder)
        self.mainArea.layout().addWidget(view)
        self._set_modified(False)

        self.auto_commit_widget = gui.auto_commit(
            widget=self.controlArea,
            master=self,
            value="autocommit",
            label="Apply",
            commit=self.commit,
        )
Пример #32
0
    def __init__(self):
        OWDataProjectionWidget.__init__(self)
        ConcurrentWidgetMixin.__init__(self)
        #: Input dissimilarity matrix
        self.matrix = None  # type: Optional[DistMatrix]
        #: Data table from the `self.matrix.row_items` (if present)
        self.matrix_data = None  # type: Optional[Table]
        #: Input data table
        self.signal_data = None

        self.embedding = None  # type: Optional[np.ndarray]
        self.effective_matrix = None  # type: Optional[DistMatrix]

        self.graph.pause_drawing_pairs()

        self.size_model = self.gui.points_models[2]
        self.size_model.order = \
            self.gui.points_models[2].order[:1] \
            + ("Stress", ) + \
            self.gui.points_models[2].order[1:]
Пример #33
0
 def __init__(self):
     OWDataProjectionWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)
     self.embedding = None  # type: Optional[np.ndarray]
Пример #34
0
 def __init__(self):
     OWAnchorProjectionWidget.__init__(self)
     ConcurrentWidgetMixin.__init__(self)