コード例 #1
0
ファイル: OWNxClustering.py プロジェクト: r0b1n1983liu/o3env
    def __init__(self):
        super().__init__()

        self.net = None

        commit = lambda: self.commit()
        gui.spin(self.controlArea, self, "iterations", 1, 100000, 1, label="Max. iterations:", callback=commit)
        ribg = gui.radioButtonsInBox(
            self.controlArea,
            self,
            "method",
            btnLabels=[
                "Label propagation clustering (Raghavan et al., 2007)",
                "Label propagation clustering (Leung et al., 2009)",
            ],
            box="Clustering method",
            callback=commit,
        )

        gui.doubleSpin(gui.indentedBox(ribg), self, "hop_attenuation", 0, 1, 0.01, label="Hop attenuation (delta): ")

        self.info = gui.widgetLabel(self.controlArea, " ")

        gui.auto_commit(self.controlArea, self, "autoApply", "Commit", checkbox_label="Auto-commit")
        commit()
コード例 #2
0
    def _add_type_box(self):
        form = QtGui.QGridLayout()
        self.type_box = box = gui.radioButtonsInBox(
                self.controlArea, self, "svmtype", [], box="SVM Type",
                orientation=form, callback=self.settings_changed)

        form.addWidget(gui.appendRadioButton(box, "C-SVM", addToLayout=False),
                       0, 0, Qt.AlignLeft)
        form.addWidget(QtGui.QLabel("Cost (C)"),
                       0, 1, Qt.AlignRight)
        form.addWidget(gui.doubleSpin(box, self, "C", 1e-3, 1000.0, 0.1,
                                      decimals=3, alignment=Qt.AlignRight,
                                      controlWidth=80, addToLayout=False,
                                      callback=self.settings_changed),
                       0, 2)

        form.addWidget(gui.appendRadioButton(box, "ν-SVM", addToLayout=False),
                       1, 0, Qt.AlignLeft)
        form.addWidget(QtGui.QLabel("Complexity (ν)"),
                       1, 1, Qt.AlignRight)
        form.addWidget(gui.doubleSpin(box, self, "nu", 0.05, 1.0, 0.05,
                                      decimals=2, alignment=Qt.AlignRight,
                                      controlWidth=80, addToLayout=False,
                                      callback=self.settings_changed),
                       1, 2)
コード例 #3
0
ファイル: owdbscan.py プロジェクト: r0b1n1983liu/o3env
    def __init__(self):
        super().__init__()

        self.data = None
        self.db = None

        box = gui.widgetBox(self.controlArea, "Parameters")
        gui.spin(box, self, "min_samples", 1, 100, 1, callback=self._invalidate,
                 label="Core point neighbors")
        gui.doubleSpin(box, self, "eps", 0.1, 0.9, 0.1,
                       callback=self._invalidate,
                       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._invalidate)

        box = gui.widgetBox(self.controlArea, "Output")
        gui.comboBox(box, self, "place_cluster_ids",
                     label="Append cluster id as ", orientation="horizontal",
                     callback=self.send_data, items=self.OUTPUT_METHODS)
        gui.lineEdit(box, self, "output_name",
                     label="Name: ", orientation="horizontal",
                     callback=self.send_data)

        gui.auto_commit(self.controlArea, self, "auto_run", "Run",
                        checkbox_label="Run after any change  ",
                        orientation="horizontal")
        gui.rubber(self.controlArea)

        self.controlArea.setMinimumWidth(self.controlArea.sizeHint().width())
        self.layout().setSizeConstraint(QtGui.QLayout.SetFixedSize)
コード例 #4
0
    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()
コード例 #5
0
    def _add_type_box(self):
        form = QGridLayout()
        self.type_box = box = gui.radioButtonsInBox(
                self.controlArea, self, "svrtype", [], box="SVR Type",
                orientation=form)

        self.epsilon_radio = gui.appendRadioButton(box, "ε-SVR",
                                                   addToLayout=False)
        self.epsilon_C_spin = gui.doubleSpin(box, self, "epsilon_C", 0.1, 512.0,
                                             0.1, decimals=2, addToLayout=False)
        self.epsilon_spin = gui.doubleSpin(box, self, "epsilon", 0.1, 512.0,
                                           0.1, decimals=2, addToLayout=False)
        form.addWidget(self.epsilon_radio, 0, 0, Qt.AlignLeft)
        form.addWidget(QLabel("Cost (C):"), 0, 1, Qt.AlignRight)
        form.addWidget(self.epsilon_C_spin, 0, 2)
        form.addWidget(QLabel("Loss epsilon (ε):"), 1, 1, Qt.AlignRight)
        form.addWidget(self.epsilon_spin, 1, 2)

        self.nu_radio = gui.appendRadioButton(box, "ν-SVR", addToLayout=False)
        self.nu_C_spin = gui.doubleSpin(box, self, "nu_C", 0.1, 512.0, 0.1,
                                        decimals=2, addToLayout=False)
        self.nu_spin = gui.doubleSpin(box, self, "nu", 0.05, 1.0, 0.05,
                                      decimals=2, addToLayout=False)
        form.addWidget(self.nu_radio, 2, 0, Qt.AlignLeft)
        form.addWidget(QLabel("Cost (C):"), 2, 1, Qt.AlignRight)
        form.addWidget(self.nu_C_spin, 2, 2)
        form.addWidget(QLabel("Complexity bound (ν):"), 3, 1, Qt.AlignRight)
        form.addWidget(self.nu_spin, 3, 2)
コード例 #6
0
    def _add_kernel_box(self):
        # Initialize with the widest label to measure max width
        self.kernel_eq = self.kernels[-1][1]

        self.kernel_box = box = gui.widgetBox(
            self.controlArea, "Kernel", orientation="horizontal")

        buttonbox = gui.radioButtonsInBox(
            box, self, "kernel_type", btnLabels=[k[0] for k in self.kernels],
            callback=self._on_kernel_changed, addSpace=20)
        buttonbox.layout().setSpacing(10)
        gui.rubber(buttonbox)

        parambox = gui.widgetBox(box)
        gui.label(parambox, self, "Kernel: %(kernel_eq)s")
        common = dict(orientation="horizontal",
                      alignment=Qt.AlignRight, controlWidth=80)
        spbox = gui.widgetBox(parambox, orientation="horizontal")
        gui.rubber(spbox)
        inbox = gui.widgetBox(spbox)
        gamma = gui.doubleSpin(
            inbox, self, "gamma", 0.0, 10.0, 0.01, label=" g: ", **common)
        coef0 = gui.doubleSpin(
            inbox, self, "coef0", 0.0, 10.0, 0.01, label=" c: ", **common)
        degree = gui.doubleSpin(
            inbox, self, "degree", 0.0, 10.0, 0.5, label=" d: ", **common)
        self._kernel_params = [gamma, coef0, degree]
        gui.rubber(parambox)

        # This is the maximal height (all double spins are visible)
        # and the maximal width (the label is initialized to the widest one)
        box.layout().activate()
        box.setFixedHeight(box.sizeHint().height())
        box.setMinimumWidth(box.sizeHint().width())
コード例 #7
0
    def __init__(self):
        super().__init__()

        self.net = None
        self.method = 0
        self.iterationHistory = 0
        self.autoApply = 0
        self.iterations = 1000
        self.hop_attenuation = 0.1

        commit = lambda: self.commit()
        gui.spin(self.controlArea, self, "iterations", 1,
                   100000, 1, label="Iterations: ",
                   callback=commit)
        ribg = gui.radioButtonsInBox(
            self.controlArea, self, "method",
            btnLabels=["Label propagation clustering (Raghavan et al., 2007)",
                    "Label propagation clustering (Leung et al., 2009)"],
            label="Method", callback=commit)

        gui.doubleSpin(gui.indentedBox(ribg), self, "hop_attenuation",
                         0, 1, 0.01, label="Hop attenuation (delta): ")

        self.info = gui.widgetLabel(self.controlArea, ' ')
        gui.checkBox(self.controlArea, self, "iterationHistory",
                       "Append clustering data on each iteration",
                       callback=commit)

        gui.auto_commit(self.controlArea, self, "autoApply", 'Commit',
                        checkbox_label='Auto-commit')
        commit()
コード例 #8
0
 def _add_optimization_box(self):
     self.optimization_box = gui.vBox(
         self.controlArea, "Optimization Parameters")
     gui.doubleSpin(
         self.optimization_box, self, "tol", 1e-6, 1.0, 1e-5,
         label="Numerical tolerance:",
         decimals=6, alignment=Qt.AlignRight, controlWidth=100,
         callback=self.settings_changed)
コード例 #9
0
    def _add_optimization_box(self):
        self.optimization_box = gui.widgetBox(
                self.controlArea, "Optimization parameters")

        gui.doubleSpin(
                self.optimization_box, self, "tol", 1e-6, 1.0, 1e-5,
                label="Numerical Tolerance",
                decimals=6, alignment=Qt.AlignRight, controlWidth=100
        )
コード例 #10
0
ファイル: OWNxHist.py プロジェクト: janezd/orange3-network
    def addHistogramControls(self, parent=None):
        if parent is None:
            parent = self.controlArea

        boxGeneral = gui.widgetBox(parent, box="Edges")
        ribg = gui.widgetBox(boxGeneral, None, orientation="horizontal", addSpace=False)
        ribg.layout().addWidget(QLabel("Distance threshold", self),
                                4, Qt.AlignVCenter | Qt.AlignLeft)
        self.spin_low = gui.doubleSpin(ribg, self, "spinLowerThreshold",
                         0.0, float("inf"), 0.001, decimals=3,
                         callback=self.changeLowerSpin,
                         keyboardTracking=False)
        ribg.layout().addWidget(QLabel("to", self), 1, Qt.AlignCenter)
        self.spin_high = gui.doubleSpin(ribg, self, "spinUpperThreshold",
                         0.0, float("inf"), 0.001, decimals=3,
                         callback=self.changeUpperSpin,
                         keyboardTracking=False)
        self.histogram.region.sigRegionChangeFinished.connect(self.spinboxFromHistogramRegion)
#         gui.lineEdit(ribg, self, "spinLowerThreshold", "Distance threshold   ", orientation='horizontal', callback=self.changeLowerSpin, valueType=float, validator=self.validator, enterPlaceholder=True, controlWidth=60)
#         gui.lineEdit(ribg, self, "spinUpperThreshold", "", orientation='horizontal', callback=self.changeUpperSpin, valueType=float, validator=self.validator, enterPlaceholder=True, controlWidth=60)
#         ribg.layout().addStretch(1)
        #ribg = gui.radioButtonsInBox(boxGeneral, self, "andor", [], orientation='horizontal', callback = self.generateGraph)
        #gui.appendRadioButton(ribg, self, "andor", "OR", callback = self.generateGraph)
        #b = gui.appendRadioButton(ribg, self, "andor", "AND", callback = self.generateGraph)
        #b.setEnabled(False)
        #ribg.hide(False)

        ribg = gui.widgetBox(boxGeneral, None, orientation="horizontal", addSpace=False)

        gui.doubleSpin(boxGeneral, self, "percentil", 0, 100, 0.1, label="Percentile", orientation='horizontal', callback=self.setPercentil, callbackOnReturn=1, controlWidth=60)
        gui.spin(boxGeneral, self, "kNN", 0, 1000, 1, label="Include closest neighbors", orientation='horizontal', callback=self.generateGraph, callbackOnReturn=1, controlWidth=60)
        ribg.layout().addStretch(1)
        # Options
        self.attrColor = ""
        ribg = gui.radioButtonsInBox(parent, self, "netOption", [], "Node selection", callback=self.generateGraph)
        gui.appendRadioButton(ribg, "Keep all nodes")
        hb = gui.widgetBox(ribg, None, orientation="horizontal", addSpace=False)
        gui.appendRadioButton(ribg, "Components with at least nodes", insertInto=hb)
        gui.spin(hb, self, "excludeLimit", 2, 100, 1, callback=(lambda h=True: self.generateGraph(h)), controlWidth=60)
        gui.appendRadioButton(ribg, "Largest connected component")
        #gui.appendRadioButton(ribg, self, "netOption", "Connected component with vertex")
        self.attribute = None

        ### FILTER NETWORK BY ATTRIBUTE IS OBSOLETE - USE SELECT DATA WIDGET ###
        #self.attributeCombo = gui.comboBox(parent, self, "attribute", box="Filter attribute", orientation='horizontal')#, callback=self.setVertexColor)
        #self.label = ''
        #self.searchString = gui.lineEdit(self.attributeCombo.box, self, "label", callback=self.setSearchStringTimer, callbackOnType=True)
        #self.searchStringTimer = QTimer(self)
        #self.connect(self.searchStringTimer, SIGNAL("timeout()"), self.generateGraph)
        #if str(self.netOption) != '3':
        #    self.attributeCombo.box.setEnabled(False)

        ribg = gui.radioButtonsInBox(parent, self, "dstWeight", [], "Edge weights", callback=self.generateGraph)
        hb = gui.widgetBox(ribg, None, orientation="horizontal", addSpace=False)
        gui.appendRadioButton(ribg, "Proportional to distance", insertInto=hb)
        gui.appendRadioButton(ribg, "Inverted distance", insertInto=hb)
コード例 #11
0
    def __init__(self):
        super().__init__()

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

        self.words = []
        self.p_values = []
        self.fdr_values = []

        # Info section
        fbox = gui.widgetBox(self.controlArea, "Info")
        self.info_all = gui.label(fbox, self, 'Cluster words:')
        self.info_sel = gui.label(fbox, self, 'Selected words:')
        self.info_fil = gui.label(fbox, self, 'After filtering:')

        # 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,
                                     callbackOnReturn=True,
                                     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,
                                       callbackOnReturn=True,
                                       tooltip="Max p-value for word")
        self.spin_fdr.setEnabled(self.filter_by_fdr)
        gui.rubber(self.controlArea)

        # 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.ExtendedSelection)
        self.sig_words.sortByColumn(2, 0)   # 0 is ascending order
        for i in range(len(self.cols)):
            self.sig_words.resizeColumnToContents(i)
        self.mainArea.layout().addWidget(self.sig_words)
コード例 #12
0
ファイル: owadaboost.py プロジェクト: JackWangCUMT/orange3
    def add_main_layout(self):
        box = gui.widgetBox(self.controlArea, "Parameters")
        self.base_estimator = TreeLearner()
        self.base_label = gui.label(box, self, "Base estimator: " + self.base_estimator.name)

        gui.spin(box, self, "n_estimators", 1, 100, label="Number of estimators:",
                 alignment=Qt.AlignRight, callback=self.settings_changed)
        gui.doubleSpin(box, self, "learning_rate", 1e-5, 1.0, 1e-5,
                       label="Learning rate:", decimals=5, alignment=Qt.AlignRight,
                       controlWidth=90, callback=self.settings_changed)
        self.add_specific_parameters(box)
コード例 #13
0
ファイル: owadaboost.py プロジェクト: astaric/orange3
    def add_main_layout(self):
        box = gui.widgetBox(self.controlArea, "Parameters")
        self.base_estimator = self.DEFAULT_BASE_ESTIMATOR
        self.base_label = gui.label(
            box, self, "Base estimator: " + self.base_estimator.name.title())

        self.n_estimators_spin = gui.spin(
            box, self, "n_estimators", 1, 100, label="Number of estimators:",
            alignment=Qt.AlignRight, controlWidth=80,
            callback=self.settings_changed)
        self.learning_rate_spin = gui.doubleSpin(
            box, self, "learning_rate", 1e-5, 1.0, 1e-5,
            label="Learning rate:", decimals=5, alignment=Qt.AlignRight,
            controlWidth=80, callback=self.settings_changed)
        self.random_seed_spin = gui.spin(
            box, self, "random_seed", 0, 2 ** 31 - 1, controlWidth=80,
            label="Fixed seed for random generator:", alignment=Qt.AlignRight,
            callback=self.settings_changed, checked="use_random_seed",
            checkCallback=self.settings_changed)

        # Algorithms
        box = gui.widgetBox(self.controlArea, "Boosting method")
        self.cls_algorithm_combo = gui.comboBox(
            box, self, "algorithm_index", label="Classification algorithm:",
            items=self.algorithms,
            orientation=Qt.Horizontal, callback=self.settings_changed)
        self.reg_algorithm_combo = gui.comboBox(
            box, self, "loss_index", label="Regression loss function:",
            items=self.losses,
            orientation=Qt.Horizontal, callback=self.settings_changed)
コード例 #14
0
ファイル: owneuralnetwork.py プロジェクト: randxie/orange3
 def add_main_layout(self):
     box = gui.vBox(self.controlArea, "Network")
     self.hidden_layers_edit = gui.lineEdit(
         box, self, "hidden_layers_input", label="Neurons per hidden layer:",
         orientation=Qt.Horizontal, callback=self.settings_changed,
         tooltip="A list of integers defining neurons. Length of list "
                 "defines the number of layers. E.g. 4, 2, 2, 3.",
         placeholderText="e.g. 100,")
     self.activation_combo = gui.comboBox(
         box, self, "activation_index", orientation=Qt.Horizontal,
         label="Activation:", items=[i for i in self.act_lbl],
         callback=self.settings_changed)
     self.solver_combo = gui.comboBox(
         box, self, "solver_index", orientation=Qt.Horizontal,
         label="Solver:", items=[i for i in self.solv_lbl],
         callback=self.settings_changed)
     self.alpha_spin = gui.doubleSpin(
         box, self, "alpha", 1e-5, 1.0, 1e-2,
         label="Alpha:", decimals=5, alignment=Qt.AlignRight,
         callback=self.settings_changed, controlWidth=80)
     self.max_iter_spin = gui.spin(
         box, self, "max_iterations", 10, 10000, step=10,
         label="Max iterations:", orientation=Qt.Horizontal,
         alignment=Qt.AlignRight, callback=self.settings_changed,
         controlWidth=80)
コード例 #15
0
    def addHistogramControls(self):
        boxGeneral = gui.widgetBox(self.controlArea, box="Edges")
        ribg = gui.widgetBox(boxGeneral, None, orientation="horizontal", addSpace=False)
        self.spin_high = gui.doubleSpin(boxGeneral, self, 'spinUpperThreshold',
                                        0, float('inf'), 0.001, decimals=3,
                                        label='Distance threshold',
                                        callback=self.changeUpperSpin,
                                        keyboardTracking=False,
                                        controlWidth=60)
        self.histogram.region.sigRegionChangeFinished.connect(self.spinboxFromHistogramRegion)

        ribg = gui.widgetBox(boxGeneral, None, orientation="horizontal", addSpace=False)

        gui.doubleSpin(boxGeneral, self, "percentil", 0, 100, 0.1,
                      label="Percentile", orientation='horizontal',
                      callback=self.setPercentil,
                      callbackOnReturn=1, controlWidth=60)

        hbox = gui.widgetBox(boxGeneral, orientation='horizontal')
        knn_cb = gui.checkBox(hbox, self, 'include_knn',
                              label='Include also closest neighbors',
                              callback=self.generateGraph)
        knn = gui.spin(hbox, self, "kNN", 1, 1000, 1,
                       orientation='horizontal',
                       callback=self.generateGraph, callbackOnReturn=1, controlWidth=60)
        knn_cb.disables = [knn]
        knn_cb.makeConsistent()

        ribg.layout().addStretch(1)
        # Options
        ribg = gui.radioButtonsInBox(self.controlArea, self, "node_selection",
                                     box="Node selection",
                                     callback=self.generateGraph)
        gui.appendRadioButton(ribg, "Keep all nodes")
        hb = gui.widgetBox(ribg, None, orientation="horizontal", addSpace=False)
        gui.appendRadioButton(ribg, "Components with at least nodes", insertInto=hb)
        gui.spin(hb, self, "excludeLimit", 2, 100, 1,
                 callback=(lambda h=True: self.generateGraph(h)), controlWidth=60)
        gui.appendRadioButton(ribg, "Largest connected component")
        self.attribute = None

        ribg = gui.radioButtonsInBox(self.controlArea, self, "edge_weights",
                                     box="Edge weights",
                                     callback=self.generateGraph)
        hb = gui.widgetBox(ribg, None, orientation="horizontal", addSpace=False)
        gui.appendRadioButton(ribg, "Proportional to distance", insertInto=hb)
        gui.appendRadioButton(ribg, "Inverted distance", insertInto=hb)
コード例 #16
0
ファイル: OWMAPlot.py プロジェクト: nagyistoce/orange-bio
    def __init__(self, parent=None):
        super().__init__(parent)

        # GUI
        box = gui.widgetBox(self.controlArea, "Info", addSpace=True)
        self.infoBox = gui.widgetLabel(box, "No data on input.")

        box = gui.widgetBox(self.controlArea, "Split by", addSpace=True)
        self.groupCombo = gui.comboBox(
            box, self, "selectedGroup", callback=self.onGroupSelection)

        gui.comboBox(self.controlArea, self, "selectedCenterMethod",
                     box="Center Fold-change Using",
                     items=[name for name, _ in self.CENTER_METHODS],
                     callback=self.onCenterMethodChange,
                     addSpace=True)

        gui.comboBox(self.controlArea, self, "selectedMergeMethod",
                     box="Merge Replicates",
                     items=[name for name, _ in self.MERGE_METHODS],
                     tooltip="Select the method for replicate merging",
                     callback=self.onMergeMethodChange,
                     addSpace=True)

        box = gui.doubleSpin(self.controlArea, self, "zCutoff", 0.0, 3.0, 0.01,
                             box="Z-Score Cutoff",
                             callback=[self.replotMA, self.commitIf])

        gui.separator(self.controlArea)

        box = gui.widgetBox(self.controlArea, "Ouput")
        gui.checkBox(box, self, "appendZScore", "Append Z-Scores",
                     tooltip="Append calculated Z-Scores to output",
                     callback=self.commitIf)

        gui.checkBox(box, self, "appendRIValues",
                     "Append Log Ratio and Intensity values",
                     tooltip="Append calculated Log Ratio and Intensity "
                             "values to output data",
                     callback=self.commitIf)

        gui.rubber(self.controlArea)

        gui.auto_commit(self.controlArea, self, "autoCommit", "Commit")

        self.graph = pg.PlotWidget(background="w")
        self.graph.getAxis("bottom").setLabel("Intensity: log<sub>10</sub>(R*G)")
        self.graph.getAxis("left").setLabel("Log ratio: log<sub>2</sub>(R/G)")

        self.mainArea.layout().addWidget(self.graph)
        self.groups = []
        self.split_data = None, None
        self.merged_splits = None, None
        self.centered = None, None
        self.changedFlag = False
        self.data = None

        self._executor = concurrent.ThreadExecutor(
            threadPool=QThreadPool(maxThreadCount=1))
コード例 #17
0
    def __init__(self):
        super().__init__()

        self._nhops = 2
        self._edge_threshold = 0.5
        self._n_max_neighbors = 20
        self.selected_titles = []
        self.titles = []
        self.filter = ""
        self.ids = []
        self._selected_nodes = []
        self._algorithm = 0
        self._k_algorithm = 0.3

        box = gui.widgetBox(self.controlArea, "Paper Selection", orientation="vertical")
        gui.lineEdit(box, self, "filter", callback=self.filter_list, callbackOnType=True)
        self.list_titles = gui.listBox(
            box, self, "selected_titles", "titles", selectionMode=QListWidget.MultiSelection, callback=self.update_view
        )
        gui.separator(self.controlArea)
        box_pref = gui.widgetBox(self.controlArea, "Preferences", orientation="vertical")
        gui.spin(box_pref, self, "_nhops", 1, 6, 1, label="Number of hops: ", callback=self.update_view)
        gui.spin(
            box_pref, self, "_n_max_neighbors", 1, 100, 1, label="Max number of neighbors: ", callback=self.update_view
        )
        gui.doubleSpin(
            box_pref, self, "_edge_threshold", 0, 1, step=0.01, label="Edge threshold: ", callback=self.update_view
        )
        gui.separator(self.controlArea)
        box_alg = gui.widgetBox(self.controlArea, "Interest Propagation Algorithm", orientation="vertical")
        radio_box = gui.radioButtonsInBox(box_alg, self, "_algorithm", [], callback=self.update_view)
        gui.appendRadioButton(radio_box, self, "_algorithm", "Without Clustering", callback=self.update_view)
        gui.doubleSpin(
            gui.indentedBox(radio_box),
            self,
            "_k_algorithm",
            0,
            1,
            step=0.01,
            label="Parameter k: ",
            callback=self.update_view,
        )
        gui.appendRadioButton(radio_box, self, "_algorithm", "With Clustering", callback=self.update_view)

        self.inside_view = PubmedNetworkView(self)
        self.send("Nx View", self.inside_view)
コード例 #18
0
ファイル: OWGeneNetwork.py プロジェクト: astaric/orange-bio
    def __init__(self, parent=None):
        super().__init__(parent)

        self.taxids = taxonomy.common_taxids()
        self.current_taxid_index = self.taxids.index(self.taxid)

        self.data = None
        self.geneinfo = None
        self.nettask = None
        self._invalidated = False

        box = gui.widgetBox(self.controlArea, "Info")
        self.info = gui.widgetLabel(box, "No data on input\n")

        box = gui.widgetBox(self.controlArea, "Organism")
        self.organism_cb = gui.comboBox(
            box, self, "current_taxid_index",
            items=map(taxonomy.name, self.taxids),
            callback=self._update_organism
        )
        box = gui.widgetBox(self.controlArea, "Genes")
        self.genes_cb = gui.comboBox(
            box, self, "gene_var_index", callback=self._update_query_genes
        )
        self.varmodel = itemmodels.VariableListModel()
        self.genes_cb.setModel(self.varmodel)

        gui.checkBox(
            box, self, "use_attr_names",
            "Use attribute names",
            callback=self._update_query_genes
        )

        box = gui.widgetBox(self.controlArea, "Network")
        gui.comboBox(
            box, self, "network_source",
            items=[s.name for s in SOURCES],
            callback=self._on_source_db_changed
        )
        gui.checkBox(
            box, self, "include_neighborhood",
            "Include immediate gene neighbors",
            callback=self.invalidate
        )
        self.score_spin = gui.doubleSpin(
            box, self, "min_score", 0.0, 1.0, step=0.001,
            label="Minimal edge score",
            callback=self.invalidate
        )
        self.score_spin.setEnabled(SOURCES[self.network_source].score_filter)

        box = gui.widgetBox(self.controlArea, "Commit")
        gui.button(box, self, "Retrieve", callback=self.commit, default=True)

        self.setSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Fixed)
        self.layout().setSizeConstraint(QtGui.QLayout.SetFixedSize)

        self.executor = ThreadExecutor()
コード例 #19
0
    def add_main_layout(self):
        box = gui.widgetBox(self.controlArea, "Parameters")
        self.base_estimator = BRISMFLearner()

        gui.spin(box, self, "K", 1, 10000,
                 label="Latent factors:",
                 alignment=Qt.AlignRight, callback=self.settings_changed)

        gui.spin(box, self, "steps", 1, 10000,
                 label="Number of iterations:",
                 alignment=Qt.AlignRight, callback=self.settings_changed)

        gui.doubleSpin(box, self, "alpha", minv=1e-4, maxv=1e+5, step=1e-5,
                   label="Learning rate:", decimals=5, alignment=Qt.AlignRight,
                   controlWidth=90, callback=self.settings_changed)

        gui.doubleSpin(box, self, "beta",  minv=1e-4, maxv=1e+4, step=1e-4,
                       label="Regularization factor:", decimals=4,
                       alignment=Qt.AlignRight,
                       controlWidth=90, callback=self.settings_changed)
コード例 #20
0
ファイル: owsvm.py プロジェクト: PrimozGodec/orange3
    def _add_type_box(self):
        form = QGridLayout()
        self.type_box = box = gui.radioButtonsInBox(
            self.controlArea, self, "svm_type", [], box="SVM Type",
            orientation=form, callback=self._update_type)

        self.epsilon_radio = gui.appendRadioButton(
            box, "SVM", addToLayout=False)
        self.C_spin = gui.doubleSpin(
            box, self, "C", 0.1, 512.0, 0.1, decimals=2,
            alignment=Qt.AlignRight, addToLayout=False,
            callback=self.settings_changed)
        self.epsilon_spin = gui.doubleSpin(
            box, self, "epsilon", 0.1, 512.0, 0.1, decimals=2,
            alignment=Qt.AlignRight, addToLayout=False,
            callback=self.settings_changed)
        form.addWidget(self.epsilon_radio, 0, 0, Qt.AlignLeft)
        form.addWidget(QLabel("Cost (C):"), 0, 1, Qt.AlignRight)
        form.addWidget(self.C_spin, 0, 2)
        form.addWidget(QLabel(
            "Regression loss epsilon (ε):"), 1, 1, Qt.AlignRight)
        form.addWidget(self.epsilon_spin, 1, 2)

        self.nu_radio = gui.appendRadioButton(box, "ν-SVM", addToLayout=False)
        self.nu_C_spin = gui.doubleSpin(
            box, self, "nu_C", 0.1, 512.0, 0.1, decimals=2,
            alignment=Qt.AlignRight, addToLayout=False,
            callback=self.settings_changed)
        self.nu_spin = gui.doubleSpin(
            box, self, "nu", 0.05, 1.0, 0.05, decimals=2,
            alignment=Qt.AlignRight, addToLayout=False,
            callback=self.settings_changed)
        form.addWidget(self.nu_radio, 2, 0, Qt.AlignLeft)
        form.addWidget(QLabel("Regression cost (C):"), 2, 1, Qt.AlignRight)
        form.addWidget(self.nu_C_spin, 2, 2)
        form.addWidget(QLabel("Complexity bound (ν):"), 3, 1, Qt.AlignRight)
        form.addWidget(self.nu_spin, 3, 2)

        # Correctly enable/disable the appropriate boxes
        self._update_type()
コード例 #21
0
ファイル: owduplicates.py プロジェクト: biolab/orange3-text
    def __init__(self):
        super().__init__()
        self.corpus = None              # corpus taken from distances
        self.linkage = None             # hierarchical clustering linkage as returned by Orange
        self.distances = None           # DistMatrix on input
        self.clustering_mask = None     # 1D array of clusters for self.corpus
        self.threshold = 0              # hierarchical clustering distance threshold
        self.threshold_spin = None

        # Info
        self.n_documents = ''
        self.n_unique = ''
        self.n_duplicates = ''
        info_box = gui.widgetBox(self.controlArea, box='Info')
        gui.label(info_box, self, 'Documents: %(n_documents)s')
        gui.label(info_box, self, '  ◦ unique: %(n_unique)s')
        gui.label(info_box, self, '  ◦ duplicates: %(n_duplicates)s')

        # Threshold Histogram & Cluster View
        self.histogram = Histogram(self)
        self.table_view = gui.TableView(selectionMode=QListView.SingleSelection)
        self.table_model = PyTableModel()
        self.table_model.setHorizontalHeaderLabels(['Cluster', 'Size'])
        self.table_view.setModel(self.table_model)
        self.table_view.selectionModel().selectionChanged.connect(self.send_duplicates)

        # Add to main area
        height = 300
        main_area = gui.hBox(self.mainArea)
        self.histogram.setMinimumWidth(500)
        self.histogram.setMinimumHeight(height)
        self.table_view.setFixedWidth(140)
        main_area.layout().addWidget(self.histogram)
        main_area.layout().addWidget(self.table_view)

        # Controls
        gui.comboBox(self.controlArea, self, 'linkage_method', items=self.LINKAGE, box='Linkage',
                     callback=self.recalculate_linkage, orientation=Qt.Horizontal)
        self.threshold_spin = gui.doubleSpin(self.controlArea, self, 'threshold',
                                             0, float('inf'), 0.01, decimals=2,
                                             label='Distance threshold', box='Distances',
                                             callback=self.threshold_changed,
                                             keyboardTracking=False, controlWidth=60)
        self.histogram.region.sigRegionChangeFinished.connect(self.threshold_from_histogram_region)
        self.threshold_spin.setEnabled(False)
        gui.rubber(self.controlArea)

        # Output
        gui.comboBox(self.controlArea, self, "cluster_role", box='Output',
                     label='Append Cluster IDs to:', callback=self.send_corpus,
                     items=self.CLUSTER_ROLES)
コード例 #22
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.data = None
        self.preprocessors = None

        box = gui.widgetBox(self.controlArea, self.tr("Name"))
        gui.lineEdit(box, self, "learner_name")

        box = gui.widgetBox(self.controlArea, self.tr("Regularization"))
        form = QtGui.QFormLayout()
        form.setContentsMargins(0, 0, 0, 0)

        box.layout().addLayout(form)

        buttonbox = gui.radioButtonsInBox(
            box, self, "penalty_type", btnLabels=("L1", "L2"),
            orientation="horizontal"
        )
        form.addRow(self.tr("Penalty type:"), buttonbox)

        spin = gui.doubleSpin(box, self, "C", 0.0, 1024.0, step=0.0001)

        form.addRow("Reg (C):", spin)

        box = gui.widgetBox(self.controlArea, "Numerical Tolerance")
        gui.doubleSpin(box, self, "tol", 1e-7, 1e-3, 5e-7)

        gui.button(self.controlArea, self, "&Apply",
                   callback=self.apply, default=True)

        self.setSizePolicy(
            QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                              QtGui.QSizePolicy.Fixed)
        )
        self.setMinimumWidth(250)

        self.apply()
コード例 #23
0
ファイル: owsvm.py プロジェクト: PrimozGodec/orange3
 def _add_optimization_box(self):
     self.optimization_box = gui.vBox(
         self.controlArea, "Optimization Parameters")
     self.tol_spin = gui.doubleSpin(
         self.optimization_box, self, "tol", 1e-4, 1.0, 1e-4,
         label="Numerical tolerance: ",
         alignment=Qt.AlignRight, controlWidth=100,
         callback=self.settings_changed)
     self.max_iter_spin = gui.spin(
         self.optimization_box, self, "max_iter", 5, 1e6, 50,
         label="Iteration limit: ", checked="limit_iter",
         alignment=Qt.AlignRight, controlWidth=100,
         callback=self.settings_changed,
         checkCallback=self.settings_changed)
コード例 #24
0
ファイル: owsgdregression.py プロジェクト: 675801717/orange3
    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()
コード例 #25
0
ファイル: OWFeatureSelection.py プロジェクト: tmzl/orange-bio
    def __init__(self, parent=None):
        widget.OWWidget.__init__(self, parent)

        self.min_value, self.max_value = \
            self.thresholds.get(self.Scores[self.score_index][0], (1, 0))

        #: Input data set
        self.data = None
        #: Current target group selection
        self.targets = []
        #: The computed scores
        self.scores = None
        #: The computed scores from label permutations
        self.nulldist = None

        self.__scores_future = self.__scores_state = None

        self.__in_progress = False

        self.test_f = {
            OWFeatureSelection.LowTail: test_low,
            OWFeatureSelection.HighTail: test_high,
            OWFeatureSelection.TwoTail: test_two_tail,
        }

        self.histogram = Histogram(
            enableMouse=False, enableMenu=False, background="w"
        )
        self.histogram.enableAutoRange(enable=True)
        self.histogram.getViewBox().setMouseEnabled(False, False)
        self.histogram.selectionChanged.connect(
            self.__on_histogram_plot_selection_changed
        )
        self.histogram.selectionEdited.connect(
            self._invalidate_selection
        )

        self.mainArea.layout().addWidget(self.histogram)

        box = gui.widgetBox(self.controlArea, "Info")

        self.dataInfoLabel = gui.widgetLabel(box, "No data on input.\n")
        self.dataInfoLabel.setWordWrap(True)
        self.selectedInfoLabel = gui.widgetLabel(box, "\n")

        box1 = gui.widgetBox(self.controlArea, "Scoring Method")
        gui.comboBox(box1, self, "score_index",
                     items=[sm[0] for sm in self.Scores],
                     callback=[self.on_scoring_method_changed,
                               self.update_scores])

        box = gui.widgetBox(self.controlArea, "Target Labels")
        self.label_selection_widget = guiutils.LabelSelectionWidget(self)
        self.label_selection_widget.setMaximumHeight(150)
        box.layout().addWidget(self.label_selection_widget)

        self.label_selection_widget.groupChanged.connect(
            self.on_label_activated)

        self.label_selection_widget.groupSelectionChanged.connect(
            self.on_target_changed)

        box = gui.widgetBox(self.controlArea, "Selection")
        box.layout().setSpacing(0)

        self.max_value_spin = gui.doubleSpin(
            box, self, "max_value", minv=-1e6, maxv=1e6, step=1e-6,
            label="Upper threshold:", callback=self.update_boundary,
            callbackOnReturn=True)

        self.low_value_spin = gui.doubleSpin(
            box, self, "min_value", minv=-1e6, maxv=1e6, step=1e-6,
            label="Lower threshold:", callback=self.update_boundary,
            callbackOnReturn=True)

        check = gui.checkBox(
            box, self, "compute_null", "Compute null distribution",
            callback=self.update_scores)

        perm_spin = gui.spin(
            box, self, "permutations_count", minv=1, maxv=50,
            label="Permutations:", callback=self.update_scores,
            callbackOnReturn=True)

        check.disables.append(perm_spin)

        box1 = gui.widgetBox(box, orientation='horizontal')

        pval_spin = gui.doubleSpin(
            box1, self, "alpha_value", minv=2e-7, maxv=1.0, step=1e-7,
            label="α-value:")
        pval_select = gui.button(
            box1, self, "Select", callback=self.select_p_best,
            autoDefault=False
        )
        check.disables.append(pval_spin)
        check.disables.append(pval_select)

        check.makeConsistent()

        box1 = gui.widgetBox(box, orientation='horizontal')
        gui.spin(box1, self, "n_best", 0, 10000, step=1,
                 label="Best Ranked:")
        gui.button(box1, self, "Select", callback=self.select_n_best,
                   autoDefault=False)

        box = gui.widgetBox(self.controlArea, "Output")

        acbox = gui.auto_commit(
            box, self, "auto_commit", "Commit", box=None)
        acbox.button.setDefault(True)

        gui.checkBox(box, self, "add_scores_to_output",
                     "Add gene scores to output",
                     callback=self._invalidate_selection)

        gui.rubber(self.controlArea)

        self.on_scoring_method_changed()
        self._executor = concurrent.ThreadExecutor()
コード例 #26
0
    def add_main_layout(self):
        # hbox = gui.hBox(self.controlArea, "Settings")

        # Frist groupbox (Common parameters)
        box = gui.widgetBox(self.controlArea, "Parameters")

        gui.spin(box,
                 self,
                 "num_factors",
                 1,
                 10000,
                 label="Number of latent factors:",
                 alignment=Qt.AlignRight,
                 callback=self.settings_changed)

        gui.spin(box,
                 self,
                 "num_iter",
                 1,
                 10000,
                 label="Number of iterations:",
                 alignment=Qt.AlignRight,
                 callback=self.settings_changed)

        gui.doubleSpin(box,
                       self,
                       "learning_rate",
                       minv=1e-5,
                       maxv=1e+5,
                       step=1e-5,
                       label="Learning rate:",
                       decimals=5,
                       alignment=Qt.AlignRight,
                       controlWidth=90,
                       callback=self.settings_changed)

        gui.doubleSpin(box,
                       self,
                       "bias_learning_rate",
                       minv=1e-5,
                       maxv=1e+5,
                       step=1e-5,
                       label="     Bias learning rate:",
                       decimals=5,
                       alignment=Qt.AlignRight,
                       controlWidth=90,
                       callback=self.settings_changed)

        gui.doubleSpin(box,
                       self,
                       "lmbda",
                       minv=1e-4,
                       maxv=1e+4,
                       step=1e-4,
                       label="Regularization:",
                       decimals=4,
                       alignment=Qt.AlignRight,
                       controlWidth=90,
                       callback=self.settings_changed)

        gui.doubleSpin(box,
                       self,
                       "bias_lmbda",
                       minv=1e-4,
                       maxv=1e+4,
                       step=1e-4,
                       label="     Bias regularization:",
                       decimals=4,
                       alignment=Qt.AlignRight,
                       controlWidth=90,
                       callback=self.settings_changed)

        gui.doubleSpin(box,
                       self,
                       "social_lmbda",
                       minv=1e-4,
                       maxv=1e+4,
                       step=1e-4,
                       label="     Social regularization:",
                       decimals=4,
                       alignment=Qt.AlignRight,
                       controlWidth=90,
                       callback=self.settings_changed)

        # Second groupbox (SGD optimizers)
        box = gui.widgetBox(self.controlArea, "SGD optimizers")

        gui.comboBox(box,
                     self,
                     "opt_type",
                     label="SGD optimizer: ",
                     items=self._Optimizer.names,
                     orientation=Qt.Horizontal,
                     addSpace=4,
                     callback=self._opt_changed)

        _m_comp = gui.doubleSpin(box,
                                 self,
                                 "momentum",
                                 minv=1e-4,
                                 maxv=1e+4,
                                 step=1e-4,
                                 label="Momentum:",
                                 decimals=4,
                                 alignment=Qt.AlignRight,
                                 controlWidth=90,
                                 callback=self.settings_changed)

        _r_comp = gui.doubleSpin(box,
                                 self,
                                 "rho",
                                 minv=1e-4,
                                 maxv=1e+4,
                                 step=1e-4,
                                 label="Rho:",
                                 decimals=4,
                                 alignment=Qt.AlignRight,
                                 controlWidth=90,
                                 callback=self.settings_changed)

        _b1_comp = gui.doubleSpin(box,
                                  self,
                                  "beta1",
                                  minv=1e-5,
                                  maxv=1e+5,
                                  step=1e-4,
                                  label="Beta 1:",
                                  decimals=5,
                                  alignment=Qt.AlignRight,
                                  controlWidth=90,
                                  callback=self.settings_changed)

        _b2_comp = gui.doubleSpin(box,
                                  self,
                                  "beta2",
                                  minv=1e-5,
                                  maxv=1e+5,
                                  step=1e-4,
                                  label="Beta 2:",
                                  decimals=5,
                                  alignment=Qt.AlignRight,
                                  controlWidth=90,
                                  callback=self.settings_changed)
        gui.rubber(box)
        self._opt_params = [_m_comp, _r_comp, _b1_comp, _b2_comp]
        self._show_right_optimizer()

        # Third groupbox (Random state)
        box = gui.widgetBox(self.controlArea, "Random state")
        rndstate = gui.radioButtons(box,
                                    self,
                                    "seed_type",
                                    callback=self.settings_changed)
        gui.appendRadioButton(rndstate, "Random seed")
        gui.appendRadioButton(rndstate, "Fixed seed")
        ibox = gui.indentedBox(rndstate)
        self.spin_rnd_seed = gui.spin(ibox,
                                      self,
                                      "random_seed",
                                      -1e5,
                                      1e5,
                                      label="Seed:",
                                      alignment=Qt.AlignRight,
                                      callback=self.settings_changed)
        self.settings_changed()  # Update (extra) settings
コード例 #27
0
ファイル: test_gui.py プロジェクト: Ameobea/orange3
 def test_checked_extension(self):
     widget = OWWidget()
     gui.doubleSpin(widget=widget, master=self, value="some_param",
                    minv=1, maxv=10, checked="some_option")
コード例 #28
0
    def __init__(self, parent=None):
        widget.OWWidget.__init__(self, parent)

        self.min_value, self.max_value = self.thresholds.get(
            self.Scores[self.score_index][0], (1, 0))

        # threshold defining expressed genes (for Hypergeometric Test)
        self.expression_threshold_value = 1.0

        #: Input data set
        self.data = None
        #: Current target group selection
        self.targets = []
        #: The computed scores
        self.scores = None
        #: The computed scores from label permutations
        self.nulldist = None

        self.__scores_future = self.__scores_state = None

        self.__in_progress = False

        self.test_f = {
            OWDifferentialExpression.LowTail: test_low,
            OWDifferentialExpression.HighTail: test_high,
            OWDifferentialExpression.TwoTail: test_two_tail,
        }

        self.histogram = Histogram(enableMouse=False,
                                   enableMenu=False,
                                   background="w")
        self.histogram.enableAutoRange(enable=False)
        self.histogram.getPlotItem().hideButtons()  # hide auto range button
        self.histogram.getViewBox().setMouseEnabled(False, False)
        self.histogram.selectionChanged.connect(
            self.__on_histogram_plot_selection_changed)
        self.histogram.selectionEdited.connect(self._invalidate_selection)

        self.mainArea.layout().addWidget(self.histogram)

        box = gui.widgetBox(self.controlArea, "Info")

        self.dataInfoLabel = gui.widgetLabel(box, "No data on input.\n")
        self.dataInfoLabel.setWordWrap(True)
        self.selectedInfoLabel = gui.widgetLabel(box, "\n")

        box1 = gui.widgetBox(self.controlArea, "Scoring Method")
        gui.comboBox(
            box1,
            self,
            "score_index",
            items=[sm[0] for sm in self.Scores],
            callback=[self.on_scoring_method_changed, self.update_scores],
        )

        self.expression_threshold_box = gui.widgetBox(self.controlArea,
                                                      'Expression threshold')
        self.expression_threshold = gui.doubleSpin(
            self.expression_threshold_box,
            self,
            "expression_threshold_value",
            minv=0,
            maxv=1e2,
            step=1e-2,
            callback=self.update_scores,
            callbackOnReturn=True,
        )

        box = gui.widgetBox(self.controlArea, "Target Labels")
        self.label_selection_widget = guiutils.LabelSelectionWidget()
        self.label_selection_widget.setMaximumHeight(150)
        box.layout().addWidget(self.label_selection_widget)

        self.label_selection_widget.groupChanged.connect(
            self.on_label_activated)

        self.label_selection_widget.groupSelectionChanged.connect(
            self.on_target_changed)

        box = gui.widgetBox(self.controlArea, "Selection")
        box.layout().setSpacing(0)

        self.max_value_spin = gui.doubleSpin(
            box,
            self,
            "max_value",
            minv=-1e6,
            maxv=1e6,
            step=1e-6,
            label="Upper threshold:",
            callback=self.update_boundary,
            callbackOnReturn=True,
        )

        self.low_value_spin = gui.doubleSpin(
            box,
            self,
            "min_value",
            minv=-1e6,
            maxv=1e6,
            step=1e-6,
            label="Lower threshold:",
            callback=self.update_boundary,
            callbackOnReturn=True,
        )

        check = gui.checkBox(box,
                             self,
                             "compute_null",
                             "Compute null distribution",
                             callback=self.update_scores)

        perm_spin = gui.spin(
            box,
            self,
            "permutations_count",
            minv=1,
            maxv=50,
            label="Permutations:",
            callback=self.update_scores,
            callbackOnReturn=True,
        )

        check.disables.append(perm_spin)

        box1 = gui.widgetBox(box, orientation='horizontal')

        pval_spin = gui.doubleSpin(box1,
                                   self,
                                   "alpha_value",
                                   minv=2e-7,
                                   maxv=1.0,
                                   step=1e-7,
                                   label="α-value:")
        pval_select = gui.button(box1,
                                 self,
                                 "Select",
                                 callback=self.select_p_best,
                                 autoDefault=False)
        check.disables.append(pval_spin)
        check.disables.append(pval_select)

        check.makeConsistent()

        box1 = gui.widgetBox(box, orientation='horizontal')
        gui.spin(box1, self, "n_best", 0, 10000, step=1, label="Best Ranked:")
        gui.button(box1,
                   self,
                   "Select",
                   callback=self.select_n_best,
                   autoDefault=False)

        box = gui.widgetBox(self.controlArea, "Output")

        acbox = gui.auto_commit(box, self, "auto_commit", "Commit", box=None)
        acbox.button.setDefault(True)

        gui.rubber(self.controlArea)

        self.on_scoring_method_changed()
        self._executor = concurrent.ThreadExecutor()
コード例 #29
0
ファイル: owannotator.py プロジェクト: biolab/orange3-text
    def __add_annotation_controls(self):
        combo_options = {
            "labelWidth": 50,
            "orientation": Qt.Horizontal,
            "searchable": True,
            "sendSelectedValue": True,
            "contentsLength": 14
        }
        box = gui.vBox(self.controlArea, box="Axes")
        order = DomainModel.METAS, DomainModel.ATTRIBUTES, DomainModel.CLASSES
        mod = DomainModel(order, valid_types=ContinuousVariable)
        gui.comboBox(box,
                     self,
                     "attr_x",
                     label="Axis x:",
                     model=mod,
                     callback=self.__on_axis_attr_changed,
                     **combo_options)
        gui.comboBox(box,
                     self,
                     "attr_y",
                     label="Axis y:",
                     model=mod,
                     callback=self.__on_axis_attr_changed,
                     **combo_options)

        box = gui.vBox(self.controlArea, box="Annotation")
        rbuttons = gui.radioButtons(box,
                                    self,
                                    "clustering_type",
                                    callback=self.__on_clustering_type_changed)

        gui.appendRadioButton(rbuttons, "DBSCAN")
        self.dbscan_box = ibox = gui.indentedBox(rbuttons,
                                                 20,
                                                 orientation=Qt.Horizontal)
        gui.checkBox(ibox,
                     self,
                     "use_epsilon",
                     "epsilon:",
                     labelWidth=80,
                     callback=self.__on_epsilon_check_changed)
        gui.doubleSpin(ibox,
                       self,
                       "epsilon",
                       0.1,
                       10,
                       0.1,
                       callback=self.__on_epsilon_changed)

        gui.appendRadioButton(rbuttons, "Gaussian mixture models")
        self.gmm_box = ibox = gui.indentedBox(rbuttons,
                                              20,
                                              orientation=Qt.Horizontal)
        gui.checkBox(ibox,
                     self,
                     "use_n_components",
                     "clusters:",
                     labelWidth=80,
                     callback=self.__on_n_components_check_changed)
        gui.spin(ibox,
                 self,
                 "n_components",
                 1,
                 100,
                 callback=self.__on_n_components_changed)

        gui.appendRadioButton(rbuttons, "From variable")
        self.var_box = ibox = gui.indentedBox(rbuttons,
                                              20,
                                              orientation=Qt.Horizontal)
        gui.comboBox(ibox,
                     self,
                     "cluster_var",
                     model=DomainModel(order, valid_types=DiscreteVariable),
                     callback=self.__on_cluster_var_changed,
                     **combo_options)

        gui.doubleSpin(box,
                       self,
                       "p_threshold",
                       0,
                       1,
                       0.01,
                       label="FDR threshold:",
                       labelWidth=100,
                       callback=self.__on_fdr_threshold_changed)
コード例 #30
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.data = None
        self.preprocessors = None

        box = gui.widgetBox(self.controlArea, self.tr("Name"))
        gui.lineEdit(box, self, "learner_name")

        form = QtGui.QGridLayout()
        typebox = gui.radioButtonsInBox(
            self.controlArea,
            self,
            "svmtype",
            [],
            box=self.tr("SVM Type"),
            orientation=form,
        )

        c_svm = gui.appendRadioButton(typebox, "C-SVM", addToLayout=False)
        form.addWidget(c_svm, 0, 0, Qt.AlignLeft)
        form.addWidget(QtGui.QLabel(self.tr("Cost (C)")), 0, 1, Qt.AlignRight)
        c_spin = gui.doubleSpin(typebox,
                                self,
                                "C",
                                0.1,
                                512.0,
                                0.1,
                                decimals=2,
                                addToLayout=False)

        form.addWidget(c_spin, 0, 2)

        nu_svm = gui.appendRadioButton(typebox, "ν-SVM", addToLayout=False)
        form.addWidget(nu_svm, 1, 0, Qt.AlignLeft)

        form.addWidget(QtGui.QLabel(self.trUtf8("Complexity bound (\u03bd)")),
                       1, 1, Qt.AlignRight)

        nu_spin = gui.doubleSpin(typebox,
                                 self,
                                 "nu",
                                 0.05,
                                 1.0,
                                 0.05,
                                 decimals=2,
                                 addToLayout=False)
        form.addWidget(nu_spin, 1, 2)

        box = gui.widgetBox(self.controlArea, self.tr("Kernel"))
        buttonbox = gui.radioButtonsInBox(box,
                                          self,
                                          "kernel_type",
                                          btnLabels=[
                                              "Linear,   x∙y",
                                              "Polynomial,   (g x∙y + c)^d",
                                              "RBF,   exp(-g|x-y|²)",
                                              "Sigmoid,   tanh(g x∙y + c)"
                                          ],
                                          callback=self._on_kernel_changed)
        parambox = gui.widgetBox(box, orientation="horizontal")
        gamma = gui.doubleSpin(parambox,
                               self,
                               "gamma",
                               0.0,
                               10.0,
                               0.0001,
                               label=" g: ",
                               orientation="horizontal",
                               alignment=Qt.AlignRight)
        coef0 = gui.doubleSpin(parambox,
                               self,
                               "coef0",
                               0.0,
                               10.0,
                               0.0001,
                               label=" c: ",
                               orientation="horizontal",
                               alignment=Qt.AlignRight)
        degree = gui.doubleSpin(parambox,
                                self,
                                "degree",
                                0.0,
                                10.0,
                                0.5,
                                label=" d: ",
                                orientation="horizontal",
                                alignment=Qt.AlignRight)
        self._kernel_params = [gamma, coef0, degree]
        box = gui.widgetBox(self.controlArea, "Numerical Tolerance")
        gui.doubleSpin(box, self, "tol", 1e-7, 1e-3, 5e-7)

        gui.button(self.controlArea,
                   self,
                   "&Apply",
                   callback=self.apply,
                   default=True)

        self.setSizePolicy(
            QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                              QtGui.QSizePolicy.Fixed))

        self.setMinimumWidth(300)

        self._on_kernel_changed()

        self.apply()
コード例 #31
0
    def __init__(self, parent=None):
        super().__init__(self, parent)

        self.clusterDataset = None
        self.referenceDataset = None
        self.ontology = None
        self.annotations = None
        self.loadedAnnotationCode = "---"
        self.treeStructRootKey = None
        self.probFunctions = [stats.Binomial(), stats.Hypergeometric()]
        self.selectedTerms = []

        self.selectionChanging = 0
        self.__state = OWGOEnrichmentAnalysis.Initializing

        self.annotationCodes = []

        #############
        ## GUI
        #############
        self.tabs = gui.tabWidget(self.controlArea)
        ## Input tab
        self.inputTab = gui.createTabPage(self.tabs, "Input")
        box = gui.widgetBox(self.inputTab, "Info")
        self.infoLabel = gui.widgetLabel(box, "No data on input\n")

        gui.button(
            box,
            self,
            "Ontology/Annotation Info",
            callback=self.ShowInfo,
            tooltip="Show information on loaded ontology and annotations")

        box = gui.widgetBox(self.inputTab, "Organism")
        self.annotationComboBox = gui.comboBox(box,
                                               self,
                                               "annotationIndex",
                                               items=self.annotationCodes,
                                               callback=self._updateEnrichment,
                                               tooltip="Select organism")

        genebox = gui.widgetBox(self.inputTab, "Gene Names")
        self.geneAttrIndexCombo = gui.comboBox(
            genebox,
            self,
            "geneAttrIndex",
            callback=self._updateEnrichment,
            tooltip="Use this attribute to extract gene names from input data")
        self.geneAttrIndexCombo.setDisabled(self.useAttrNames)

        cb = gui.checkBox(genebox,
                          self,
                          "useAttrNames",
                          "Use column names",
                          tooltip="Use column names for gene names",
                          callback=self._updateEnrichment)
        cb.toggled[bool].connect(self.geneAttrIndexCombo.setDisabled)

        gui.button(genebox,
                   self,
                   "Gene matcher settings",
                   callback=self.UpdateGeneMatcher,
                   tooltip="Open gene matching settings dialog")

        self.referenceRadioBox = gui.radioButtonsInBox(
            self.inputTab,
            self,
            "useReferenceDataset", ["Entire genome", "Reference set (input)"],
            tooltips=[
                "Use entire genome for reference",
                "Use genes from Referece Examples input signal as reference"
            ],
            box="Reference",
            callback=self._updateEnrichment)

        self.referenceRadioBox.buttons[1].setDisabled(True)
        gui.radioButtonsInBox(
            self.inputTab,
            self,
            "aspectIndex",
            ["Biological process", "Cellular component", "Molecular function"],
            box="Aspect",
            callback=self._updateEnrichment)

        ## Filter tab
        self.filterTab = gui.createTabPage(self.tabs, "Filter")
        box = gui.widgetBox(self.filterTab, "Filter GO Term Nodes")
        gui.checkBox(
            box,
            self,
            "filterByNumOfInstances",
            "Genes",
            callback=self.FilterAndDisplayGraph,
            tooltip="Filter by number of input genes mapped to a term")
        ibox = gui.indentedBox(box)
        gui.spin(ibox,
                 self,
                 'minNumOfInstances',
                 1,
                 100,
                 step=1,
                 label='#:',
                 labelWidth=15,
                 callback=self.FilterAndDisplayGraph,
                 callbackOnReturn=True,
                 tooltip="Min. number of input genes mapped to a term")

        gui.checkBox(box,
                     self,
                     "filterByPValue_nofdr",
                     "p-value",
                     callback=self.FilterAndDisplayGraph,
                     tooltip="Filter by term p-value")

        gui.doubleSpin(gui.indentedBox(box),
                       self,
                       'maxPValue_nofdr',
                       1e-8,
                       1,
                       step=1e-8,
                       label='p:',
                       labelWidth=15,
                       callback=self.FilterAndDisplayGraph,
                       callbackOnReturn=True,
                       tooltip="Max term p-value")

        #use filterByPValue for FDR, as it was the default in prior versions
        gui.checkBox(box,
                     self,
                     "filterByPValue",
                     "FDR",
                     callback=self.FilterAndDisplayGraph,
                     tooltip="Filter by term FDR")
        gui.doubleSpin(gui.indentedBox(box),
                       self,
                       'maxPValue',
                       1e-8,
                       1,
                       step=1e-8,
                       label='p:',
                       labelWidth=15,
                       callback=self.FilterAndDisplayGraph,
                       callbackOnReturn=True,
                       tooltip="Max term p-value")

        box = gui.widgetBox(box, "Significance test")

        gui.radioButtonsInBox(box,
                              self,
                              "probFunc", ["Binomial", "Hypergeometric"],
                              tooltips=[
                                  "Use binomial distribution test",
                                  "Use hypergeometric distribution test"
                              ],
                              callback=self._updateEnrichment)
        box = gui.widgetBox(self.filterTab,
                            "Evidence codes in annotation",
                            addSpace=True)
        self.evidenceCheckBoxDict = {}
        for etype in go.evidenceTypesOrdered:
            ecb = QCheckBox(etype,
                            toolTip=go.evidenceTypes[etype],
                            checked=self.useEvidenceType[etype])
            ecb.toggled.connect(self.__on_evidenceChanged)
            box.layout().addWidget(ecb)
            self.evidenceCheckBoxDict[etype] = ecb

        ## Select tab
        self.selectTab = gui.createTabPage(self.tabs, "Select")
        box = gui.radioButtonsInBox(self.selectTab,
                                    self,
                                    "selectionDirectAnnotation",
                                    ["Directly or Indirectly", "Directly"],
                                    box="Annotated genes",
                                    callback=self.ExampleSelection)

        box = gui.widgetBox(self.selectTab, "Output", addSpace=True)
        gui.radioButtonsInBox(
            box,
            self,
            "selectionDisjoint",
            btnLabels=[
                "All selected genes", "Term-specific genes",
                "Common term genes"
            ],
            tooltips=[
                "Outputs genes annotated to all selected GO terms",
                "Outputs genes that appear in only one of selected GO terms",
                "Outputs genes common to all selected GO terms"
            ],
            callback=[self.ExampleSelection, self.UpdateAddClassButton])

        self.addClassCB = gui.checkBox(box,
                                       self,
                                       "selectionAddTermAsClass",
                                       "Add GO Term as class",
                                       callback=self.ExampleSelection)

        # ListView for DAG, and table for significant GOIDs
        self.DAGcolumns = [
            'GO term', 'Cluster', 'Reference', 'p-value', 'FDR', 'Genes',
            'Enrichment'
        ]

        self.splitter = QSplitter(Qt.Vertical, self.mainArea)
        self.mainArea.layout().addWidget(self.splitter)

        # list view
        self.listView = GOTreeWidget(self.splitter)
        self.listView.setSelectionMode(QTreeView.ExtendedSelection)
        self.listView.setAllColumnsShowFocus(1)
        self.listView.setColumnCount(len(self.DAGcolumns))
        self.listView.setHeaderLabels(self.DAGcolumns)

        self.listView.header().setSectionsClickable(True)
        self.listView.header().setSortIndicatorShown(True)
        self.listView.setSortingEnabled(True)
        self.listView.setItemDelegateForColumn(
            6, EnrichmentColumnItemDelegate(self))
        self.listView.setRootIsDecorated(True)

        self.listView.itemSelectionChanged.connect(self.ViewSelectionChanged)

        # table of significant GO terms
        self.sigTerms = QTreeWidget(self.splitter)
        self.sigTerms.setColumnCount(len(self.DAGcolumns))
        self.sigTerms.setHeaderLabels(self.DAGcolumns)
        self.sigTerms.setSortingEnabled(True)
        self.sigTerms.setSelectionMode(QTreeView.ExtendedSelection)
        self.sigTerms.setItemDelegateForColumn(
            6, EnrichmentColumnItemDelegate(self))

        self.sigTerms.itemSelectionChanged.connect(self.TableSelectionChanged)

        self.sigTableTermsSorted = []
        self.graph = {}

        self.inputTab.layout().addStretch(1)
        self.filterTab.layout().addStretch(1)
        self.selectTab.layout().addStretch(1)

        self.setBlocking(True)
        self._executor = ThreadExecutor()
        self._init = EnsureDownloaded([(taxonomy.Taxonomy.DOMAIN,
                                        taxonomy.Taxonomy.FILENAME),
                                       ("GO", "taxonomy.pickle")])
        self._init.finished.connect(self.__initialize_finish)
        self._executor.submit(self._init)
コード例 #32
0
    def add_main_layout(self):

        self.data = None
        self.learner = None

        self.scatterplot_item = None
        self.plot_item = None

        self.x_label = 'x'
        self.y_label = 'y'

        self.rmse = ""
        self.mae = ""
        self.regressor_name = self.default_learner_name

        # info box
        info_box = gui.vBox(self.controlArea, "Info")
        self.regressor_label = gui.label(
            widget=info_box,
            master=self,
            label="Regressor: %(regressor_name).30s")
        gui.label(widget=info_box,
                  master=self,
                  label="Mean absolute error: %(mae).6s")
        gui.label(widget=info_box,
                  master=self,
                  label="Root mean square error: %(rmse).6s")

        box = gui.vBox(self.controlArea, "Variables")

        self.x_var_model = itemmodels.VariableListModel()
        self.comboBoxAttributesX = gui.comboBox(box,
                                                self,
                                                value='x_var_index',
                                                label="Input: ",
                                                orientation=Qt.Horizontal,
                                                callback=self.apply,
                                                maximumContentsLength=15)
        self.comboBoxAttributesX.setModel(self.x_var_model)
        self.expansion_spin = gui.doubleSpin(gui.indentedBox(box),
                                             self,
                                             "polynomialexpansion",
                                             0,
                                             10,
                                             label="Polynomial expansion:",
                                             callback=self.apply)

        gui.separator(box, height=8)
        self.y_var_model = itemmodels.VariableListModel()
        self.comboBoxAttributesY = gui.comboBox(box,
                                                self,
                                                value="y_var_index",
                                                label="Target: ",
                                                orientation=Qt.Horizontal,
                                                callback=self.apply,
                                                maximumContentsLength=15)
        self.comboBoxAttributesY.setModel(self.y_var_model)

        properties_box = gui.vBox(self.controlArea, "Properties")
        self.error_bars_checkbox = gui.checkBox(widget=properties_box,
                                                master=self,
                                                value='error_bars_enabled',
                                                label="Show error bars",
                                                callback=self.apply)

        gui.rubber(self.controlArea)

        # main area GUI
        self.plotview = pg.PlotWidget(background="w")
        self.plot = self.plotview.getPlotItem()

        axis_color = self.palette().color(QPalette.Text)
        axis_pen = QPen(axis_color)

        tickfont = QFont(self.font())
        tickfont.setPixelSize(max(int(tickfont.pixelSize() * 2 // 3), 11))

        axis = self.plot.getAxis("bottom")
        axis.setLabel(self.x_label)
        axis.setPen(axis_pen)
        axis.setTickFont(tickfont)

        axis = self.plot.getAxis("left")
        axis.setLabel(self.y_label)
        axis.setPen(axis_pen)
        axis.setTickFont(tickfont)

        self.plot.setRange(xRange=(0.0, 1.0),
                           yRange=(0.0, 1.0),
                           disableAutoRange=True)

        self.mainArea.layout().addWidget(self.plotview)
コード例 #33
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,
            'n_neighbors',
            label=
            'Number of neighbors to use by default for k neighbors queries. (IntVariable)',
            callback=None)

        gui.comboBox(box,
                     self,
                     'method',
                     label='Method to calculate outlier score.',
                     items=['largest', 'mean', 'median'],
                     callback=None)

        gui.lineEdit(
            box,
            self,
            'radius',
            label=
            'Range of parameter space to use by default for radius_neighbors queries. (Float)',
            callback=None)

        gui.comboBox(box,
                     self,
                     'algorithm',
                     label='Algorithm used to compute the nearest neighbors.',
                     items=['auto', 'ball_tree', 'kd_tree', 'brute'],
                     callback=None)

        gui.lineEdit(
            box,
            self,
            'leaf_size',
            label='Leaf size passed to BallTree or KDTree. (IntVariable)',
            callback=None)

        gui.comboBox(box,
                     self,
                     'metric',
                     label='Metric used for the distance computation.',
                     items=[
                         'cityblock', 'cosine', 'euclidean', 'l1', 'l2',
                         'manhattan', 'braycurtis', 'canberra', 'chebyshev',
                         'correlation', 'dice', 'hamming', 'jaccard',
                         'kulsinski', 'mahalanobis', 'matching', 'minkowski',
                         'rogerstanimoto', 'russellrao', 'seuclidean',
                         'sokalmichener', 'sokalsneath', 'sqeuclidean', 'yule'
                     ],
                     callback=None)

        gui.lineEdit(
            box,
            self,
            'p',
            label='Parameter for the Minkowski metric from. (IntVariable)',
            callback=None)

        gui.doubleSpin(
            box,
            self,
            "contamination",
            minv=0.,
            maxv=1.,
            step=0.001,
            label="Input contamination, float in (0,0.5].",
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        # return_subseq_inds = Setting(False)
        gui.checkBox(box,
                     self,
                     "return_subseq_inds",
                     label='If return subsequence index.',
                     callback=None)

        # use_semantic_types = Setting(False)
        gui.checkBox(box,
                     self,
                     "use_semantic_types",
                     label='Mannally select columns if active.',
                     callback=None)

        # use_columns = Setting(())
        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)

        # exclude_columns = Setting(())
        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)

        # return_result = Setting(['append', 'replace', 'new'])
        gui.comboBox(
            box,
            self,
            "return_result",
            sendSelectedValue=True,
            label='Output results.',
            items=['new', 'append', 'replace'],
        )

        # add_index_columns = Setting(False)
        gui.checkBox(box,
                     self,
                     "add_index_columns",
                     label='Keep index in the outputs.',
                     callback=None)

        # error_on_no_input = Setting(True)
        gui.checkBox(box,
                     self,
                     "error_on_no_input",
                     label='Error on no input.',
                     callback=None)

        # return_semantic_type = Setting(['https://metadata.datadrivendiscovery.org/types/Attribute',
        #                                 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'])
        gui.comboBox(
            box,
            self,
            "return_semantic_type",
            sendSelectedValue=True,
            label='Semantic type attach with results.',
            items=[
                'https://metadata.datadrivendiscovery.org/types/Attribute',
                'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'
            ],
        )
        # Only for test
        gui.button(box,
                   self,
                   "Print Hyperparameters",
                   callback=self._print_hyperparameter)

        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)
コード例 #34
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.geneMatcherSettings = [False, False, True, False]

        self.data = None
        self.referenceData = None
        self.taxid_list = []

        self.__genematcher = (None, fulfill(gene.matcher([])))
        self.__invalidated = False

        self.currentAnnotatedCategories = []
        self.state = None
        self.__state = OWSetEnrichment.Initializing

        box = gui.widgetBox(self.controlArea, "Info")
        self.infoBox = gui.widgetLabel(box, "Info")
        self.infoBox.setText("No data on input.\n")

        self.speciesComboBox = gui.comboBox(
            self.controlArea,
            self,
            "speciesIndex",
            "Species",
            callback=self.__on_speciesIndexChanged)

        box = gui.widgetBox(self.controlArea, "Entity names")
        self.geneAttrComboBox = gui.comboBox(box,
                                             self,
                                             "geneattr",
                                             "Entity feature",
                                             sendSelectedValue=0,
                                             callback=self.updateAnnotations)

        cb = gui.checkBox(box,
                          self,
                          "genesinrows",
                          "Use feature names",
                          callback=self.updateAnnotations,
                          disables=[(-1, self.geneAttrComboBox)])
        cb.makeConsistent()

        #         gui.button(box, self, "Gene matcher settings",
        #                    callback=self.updateGeneMatcherSettings,
        #                    tooltip="Open gene matching settings dialog")

        self.referenceRadioBox = gui.radioButtonsInBox(
            self.controlArea,
            self,
            "useReferenceData", ["All entities", "Reference set (input)"],
            tooltips=[
                "Use entire genome (for gene set enrichment) or all " +
                "available entities for reference",
                "Use entities from Reference Examples input signal " +
                "as reference"
            ],
            box="Reference",
            callback=self.updateAnnotations)

        box = gui.widgetBox(self.controlArea, "Entity Sets")
        self.groupsWidget = QTreeWidget(self)
        self.groupsWidget.setHeaderLabels(["Category"])
        box.layout().addWidget(self.groupsWidget)

        hLayout = QHBoxLayout()
        hLayout.setSpacing(10)
        hWidget = gui.widgetBox(self.mainArea, orientation=hLayout)
        gui.spin(hWidget,
                 self,
                 "minClusterCount",
                 0,
                 100,
                 label="Entities",
                 tooltip="Minimum entity count",
                 callback=self.filterAnnotationsChartView,
                 callbackOnReturn=True,
                 checked="useMinCountFilter",
                 checkCallback=self.filterAnnotationsChartView)

        pvalfilterbox = gui.widgetBox(hWidget, orientation="horizontal")
        cb = gui.checkBox(pvalfilterbox,
                          self,
                          "useMaxPValFilter",
                          "p-value",
                          callback=self.filterAnnotationsChartView)

        sp = gui.doubleSpin(
            pvalfilterbox,
            self,
            "maxPValue",
            0.0,
            1.0,
            0.0001,
            tooltip="Maximum p-value",
            callback=self.filterAnnotationsChartView,
            callbackOnReturn=True,
        )
        sp.setEnabled(self.useMaxFDRFilter)
        cb.toggled[bool].connect(sp.setEnabled)

        pvalfilterbox.layout().setAlignment(cb, Qt.AlignRight)
        pvalfilterbox.layout().setAlignment(sp, Qt.AlignLeft)

        fdrfilterbox = gui.widgetBox(hWidget, orientation="horizontal")
        cb = gui.checkBox(fdrfilterbox,
                          self,
                          "useMaxFDRFilter",
                          "FDR",
                          callback=self.filterAnnotationsChartView)

        sp = gui.doubleSpin(
            fdrfilterbox,
            self,
            "maxFDR",
            0.0,
            1.0,
            0.0001,
            tooltip="Maximum False discovery rate",
            callback=self.filterAnnotationsChartView,
            callbackOnReturn=True,
        )
        sp.setEnabled(self.useMaxFDRFilter)
        cb.toggled[bool].connect(sp.setEnabled)

        fdrfilterbox.layout().setAlignment(cb, Qt.AlignRight)
        fdrfilterbox.layout().setAlignment(sp, Qt.AlignLeft)

        self.filterLineEdit = QLineEdit(self, placeholderText="Filter ...")

        self.filterCompleter = QCompleter(self.filterLineEdit)
        self.filterCompleter.setCaseSensitivity(Qt.CaseInsensitive)
        self.filterLineEdit.setCompleter(self.filterCompleter)

        hLayout.addWidget(self.filterLineEdit)
        self.mainArea.layout().addWidget(hWidget)

        self.filterLineEdit.textChanged.connect(
            self.filterAnnotationsChartView)

        self.annotationsChartView = QTreeView(
            alternatingRowColors=True,
            sortingEnabled=True,
            selectionMode=QTreeView.ExtendedSelection,
            rootIsDecorated=False,
            editTriggers=QTreeView.NoEditTriggers,
        )
        self.annotationsChartView.viewport().setMouseTracking(True)
        self.mainArea.layout().addWidget(self.annotationsChartView)

        contextEventFilter = gui.VisibleHeaderSectionContextEventFilter(
            self.annotationsChartView)
        self.annotationsChartView.header().installEventFilter(
            contextEventFilter)

        self.groupsWidget.itemClicked.connect(self.subsetSelectionChanged)
        gui.auto_commit(self.controlArea, self, "autocommit", "Commit")

        self.setBlocking(True)

        task = EnsureDownloaded([(taxonomy.Taxonomy.DOMAIN,
                                  taxonomy.Taxonomy.FILENAME),
                                 (geneset.sfdomain, "index.pck")])

        task.finished.connect(self.__initialize_finish)
        self.setStatusMessage("Initializing")
        self._executor = ThreadExecutor(parent=self,
                                        threadPool=QThreadPool(self))
        self._executor.submit(task)
コード例 #35
0
    def __init__(self):
        super().__init__()

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

        self.words = []
        self.p_values = []
        self.fdr_values = []

        # Info section
        fbox = gui.widgetBox(self.controlArea, "Info")
        self.info_all = gui.label(fbox, self, 'Cluster words:')
        self.info_sel = gui.label(fbox, self, 'Selected words:')
        self.info_fil = gui.label(fbox, self, 'After filtering:')

        # 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,
                                     callbackOnReturn=True,
                                     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,
                                       callbackOnReturn=True,
                                       tooltip="Max p-value for word")
        self.spin_fdr.setEnabled(self.filter_by_fdr)
        gui.rubber(self.controlArea)

        # 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.ExtendedSelection)
        self.sig_words.sortByColumn(2, 0)  # 0 is ascending order
        for i in range(len(self.cols)):
            self.sig_words.resizeColumnToContents(i)
        self.mainArea.layout().addWidget(self.sig_words)
コード例 #36
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, 'n_neighbors',
                     label='Number of neighbors to use by default for kneighbors queries. (IntVariable)',
                     callback=self.settings_changed)

        gui.lineEdit(box, self, 'ref_set', 
                     label='Specifies the number of shared nearest neighbors to create the reference set. Note that ref_set must be smaller than n_neighbors.',
                     callback=self.settings_changed)

        gui.doubleSpin(
            box, self,
            'alpha',
            minv=0.,
            maxv=1.,
            step=0.001,
            label="Specifies the lower limit for selecting subspace. 0.8 is set as default as suggested in the original paper.",
            callback=self.settings_changed
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        gui.doubleSpin(
            box, self,
            "contamination",
            minv=0.,
            maxv=1.,
            step=0.001,
            label="Input contamination, float in (0,0.5].",
            callback=self.settings_changed
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        # return_subseq_inds = Setting(False)
        gui.checkBox(box, self, "return_subseq_inds", label='If return subsequence index.',  callback=self.settings_changed)

        # use_semantic_types = Setting(False)
        gui.checkBox(box, self, "use_semantic_types", label='Mannally select columns if active.',  callback=self.settings_changed)

        # use_columns = Setting(())
        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)

        # exclude_columns = Setting(())
        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)

        # return_result = Setting(['append', 'replace', 'new'])
        gui.comboBox(box, self, "return_result", sendSelectedValue=True, label='Output results.', items=['new', 'append', 'replace'], callback=self.settings_changed)

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

        # error_on_no_input = Setting(True)
        gui.checkBox(box, self, "error_on_no_input", label='Error on no input.',  callback=self.settings_changed)

        # return_semantic_type = Setting(['https://metadata.datadrivendiscovery.org/types/Attribute',
        #                                 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'])
        gui.comboBox(box, self, "return_semantic_type", sendSelectedValue=True, label='Semantic type attach with results.', 
                     items=['https://metadata.datadrivendiscovery.org/types/Attribute',
                            'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'], callback=self.settings_changed)
        # Only for test
        #gui.button(box, self, "Print Hyperparameters", callback=self._print_hyperparameter)

        gui.auto_apply(box, self, "autosend", box=False)
コード例 #37
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.preprocessors = None

        box = gui.widgetBox(self.controlArea, self.tr("Name"))
        gui.lineEdit(box, self, "learner_name")

        form = QGridLayout()
        typebox = gui.radioButtonsInBox(
            self.controlArea,
            self,
            "svrtype",
            [],
            box=self.tr("SVM Regression Type"),
            orientation=form,
        )

        eps_svr = gui.appendRadioButton(typebox, "ε-SVR", addToLayout=False)
        form.addWidget(eps_svr, 0, 0, Qt.AlignLeft)

        form.addWidget(QtGui.QLabel(self.tr("Cost (C)")), 0, 1, Qt.AlignRight)
        c_spin = gui.doubleSpin(typebox,
                                self,
                                "epsilon_C",
                                0.1,
                                512.0,
                                0.1,
                                decimals=2,
                                addToLayout=False)
        form.addWidget(c_spin, 0, 2)

        form.addWidget(QLabel("Loss Epsilon (ε)"), 1, 1, Qt.AlignRight)
        eps_spin = gui.doubleSpin(typebox,
                                  self,
                                  "epsilon",
                                  0.1,
                                  512.0,
                                  0.1,
                                  decimals=2,
                                  addToLayout=False)
        form.addWidget(eps_spin, 1, 2)

        nu_svr = gui.appendRadioButton(typebox, "ν-SVR", addToLayout=False)
        form.addWidget(nu_svr, 2, 0, Qt.AlignLeft)

        form.addWidget(QLabel(self.tr("Cost (C)")), 2, 1, Qt.AlignRight)
        c_spin = gui.doubleSpin(typebox,
                                self,
                                "nu_C",
                                0.1,
                                512.0,
                                0.1,
                                decimals=2,
                                addToLayout=False)
        form.addWidget(c_spin, 2, 2)

        form.addWidget(QLabel("Complexity bound (ν)"), 3, 1, Qt.AlignRight)
        nu_spin = gui.doubleSpin(typebox,
                                 self,
                                 "nu",
                                 0.05,
                                 1.0,
                                 0.05,
                                 decimals=2,
                                 addToLayout=False)
        form.addWidget(nu_spin, 3, 2)

        # Kernel control
        box = gui.widgetBox(self.controlArea, self.tr("Kernel"))
        buttonbox = gui.radioButtonsInBox(box,
                                          self,
                                          "kernel_type",
                                          btnLabels=[
                                              "Linear,   x∙y",
                                              "Polynomial,   (g x∙y + c)^d",
                                              "RBF,   exp(-g|x-y|²)",
                                              "Sigmoid,   tanh(g x∙y + c)"
                                          ],
                                          callback=self._on_kernel_changed)
        parambox = gui.widgetBox(box, orientation="horizontal")
        gamma = gui.doubleSpin(parambox,
                               self,
                               "gamma",
                               0.0,
                               10.0,
                               0.0001,
                               label=" g: ",
                               orientation="horizontal",
                               alignment=Qt.AlignRight)
        coef0 = gui.doubleSpin(parambox,
                               self,
                               "coef0",
                               0.0,
                               10.0,
                               0.0001,
                               label=" c: ",
                               orientation="horizontal",
                               alignment=Qt.AlignRight)
        degree = gui.doubleSpin(parambox,
                                self,
                                "degree",
                                0.0,
                                10.0,
                                0.5,
                                label=" d: ",
                                orientation="horizontal",
                                alignment=Qt.AlignRight)
        self._kernel_params = [gamma, coef0, degree]

        # Numerical tolerance control
        box = gui.widgetBox(self.controlArea, "Numerical Tolerance")
        gui.doubleSpin(box, self, "tol", 1e-7, 1e-3, 5e-7)

        gui.button(self.controlArea,
                   self,
                   "&Apply",
                   callback=self.apply,
                   default=True)

        self._on_kernel_changed()

        self.apply()
コード例 #38
0
ファイル: owsvm.py プロジェクト: haojia632/orange3
    def _add_type_box(self):
        form = QGridLayout()
        self.type_box = box = gui.radioButtonsInBox(self.controlArea,
                                                    self,
                                                    "svm_type", [],
                                                    box="支持向量类型",
                                                    orientation=form,
                                                    callback=self._update_type)

        self.epsilon_radio = gui.appendRadioButton(box,
                                                   "支持向量机",
                                                   addToLayout=False)
        self.C_spin = gui.doubleSpin(box,
                                     self,
                                     "C",
                                     0.1,
                                     512.0,
                                     0.1,
                                     decimals=2,
                                     alignment=Qt.AlignRight,
                                     addToLayout=False,
                                     callback=self.settings_changed)
        self.epsilon_spin = gui.doubleSpin(box,
                                           self,
                                           "epsilon",
                                           0.1,
                                           512.0,
                                           0.1,
                                           decimals=2,
                                           alignment=Qt.AlignRight,
                                           addToLayout=False,
                                           callback=self.settings_changed)
        form.addWidget(self.epsilon_radio, 0, 0, Qt.AlignLeft)
        form.addWidget(QLabel("成本(C):"), 0, 1, Qt.AlignRight)
        form.addWidget(self.C_spin, 0, 2)
        form.addWidget(QLabel("回归损失量 (ε):"), 1, 1, Qt.AlignRight)
        form.addWidget(self.epsilon_spin, 1, 2)

        self.nu_radio = gui.appendRadioButton(box,
                                              "ν-支持向量机",
                                              addToLayout=False)
        self.nu_C_spin = gui.doubleSpin(box,
                                        self,
                                        "nu_C",
                                        0.1,
                                        512.0,
                                        0.1,
                                        decimals=2,
                                        alignment=Qt.AlignRight,
                                        addToLayout=False,
                                        callback=self.settings_changed)
        self.nu_spin = gui.doubleSpin(box,
                                      self,
                                      "nu",
                                      0.05,
                                      1.0,
                                      0.05,
                                      decimals=2,
                                      alignment=Qt.AlignRight,
                                      addToLayout=False,
                                      callback=self.settings_changed)
        form.addWidget(self.nu_radio, 2, 0, Qt.AlignLeft)
        form.addWidget(QLabel("回归成本 (C):"), 2, 1, Qt.AlignRight)
        form.addWidget(self.nu_C_spin, 2, 2)
        form.addWidget(QLabel("复杂性约束(ν):"), 3, 1, Qt.AlignRight)
        form.addWidget(self.nu_spin, 3, 2)

        # Correctly enable/disable the appropriate boxes
        self._update_type()
コード例 #39
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.preprocessors = None

        box = gui.widgetBox(self.controlArea, self.tr("Name"))
        gui.lineEdit(box, self, "learner_name")

        form = QtGui.QGridLayout()
        typebox = gui.radioButtonsInBox(
            self.controlArea, self, "svmtype", [],
            box=self.tr("SVM Type"),
            orientation=form,
        )

        c_svm = gui.appendRadioButton(typebox, "C-SVM", addToLayout=False)
        form.addWidget(c_svm, 0, 0, Qt.AlignLeft)
        form.addWidget(QtGui.QLabel(self.tr("Cost (C)")), 0, 1, Qt.AlignRight)
        c_spin = gui.doubleSpin(
            typebox, self, "C", 1e-3, 1000.0, 0.1,
            decimals=3, addToLayout=False
        )

        form.addWidget(c_spin, 0, 2)

        nu_svm = gui.appendRadioButton(typebox, "ν-SVM", addToLayout=False)
        form.addWidget(nu_svm, 1, 0, Qt.AlignLeft)

        form.addWidget(
            QtGui.QLabel(self.trUtf8("Complexity bound (\u03bd)")),
            1, 1, Qt.AlignRight
        )

        nu_spin = gui.doubleSpin(
            typebox, self, "nu", 0.05, 1.0, 0.05,
            decimals=2, addToLayout=False
        )
        form.addWidget(nu_spin, 1, 2)

        box = gui.widgetBox(self.controlArea, self.tr("Kernel"))
        buttonbox = gui.radioButtonsInBox(
            box, self, "kernel_type",
            btnLabels=["Linear,   x∙y",
                       "Polynomial,   (g x∙y + c)^d",
                       "RBF,   exp(-g|x-y|²)",
                       "Sigmoid,   tanh(g x∙y + c)"],
            callback=self._on_kernel_changed
        )
        parambox = gui.widgetBox(box, orientation="horizontal")
        gamma = gui.doubleSpin(
            parambox, self, "gamma", 0.0, 10.0, 0.0001,
            label=" g: ", orientation="horizontal",
            alignment=Qt.AlignRight
        )
        coef0 = gui.doubleSpin(
            parambox, self, "coef0", 0.0, 10.0, 0.0001,
            label=" c: ", orientation="horizontal",
            alignment=Qt.AlignRight
        )
        degree = gui.doubleSpin(
            parambox, self, "degree", 0.0, 10.0, 0.5,
            label=" d: ", orientation="horizontal",
            alignment=Qt.AlignRight
        )
        self._kernel_params = [gamma, coef0, degree]
        box = gui.widgetBox(self.controlArea, "Optimization parameters")
        gui.doubleSpin(box, self, "tol", 1e-7, 1.0, 5e-7,
        label="Numerical Tolerance")
        gui.spin(box, self, "max_iter", 0, 1e6, 100,
        label="Iteration Limit", checked="limit_iter")

        gui.button(self.controlArea, self, "&Apply",
                   callback=self.apply, default=True)

        self._on_kernel_changed()

        self.apply()
コード例 #40
0
    def add_main_layout(self):
        # top-level control procedure
        top_box = gui.hBox(widget=self.controlArea, box=None, addSpace=2)

        rule_ordering_box = gui.hBox(widget=top_box, box="Rule ordering")
        rule_ordering_rbs = gui.radioButtons(widget=rule_ordering_box,
                                             master=self,
                                             value="rule_ordering",
                                             callback=self.settings_changed,
                                             btnLabels=("Ordered",
                                                        "Unordered"))
        rule_ordering_rbs.layout().setSpacing(7)

        covering_algorithm_box = gui.hBox(widget=top_box,
                                          box="Covering algorithm")
        covering_algorithm_rbs = gui.radioButtons(
            widget=covering_algorithm_box,
            master=self,
            value="covering_algorithm",
            callback=self.settings_changed,
            btnLabels=("Exclusive", "Weighted"))
        covering_algorithm_rbs.layout().setSpacing(7)

        insert_gamma_box = gui.vBox(widget=covering_algorithm_box, box=None)
        gui.separator(insert_gamma_box, 0, 14)
        self.gamma_spin = gui.doubleSpin(
            widget=insert_gamma_box,
            master=self,
            value="gamma",
            minv=0.0,
            maxv=1.0,
            step=0.01,
            label="γ:",
            orientation=Qt.Horizontal,
            callback=self.settings_changed,
            alignment=Qt.AlignRight,
            enabled=self.storage_covers[self.covering_algorithm] == "weighted")

        # bottom-level search procedure (search bias)
        middle_box = gui.vBox(widget=self.controlArea, box="Rule search")

        gui.comboBox(widget=middle_box,
                     master=self,
                     value="evaluation_measure",
                     label="Evaluation measure:",
                     orientation=Qt.Horizontal,
                     items=("Entropy", "Laplace accuracy", "WRAcc"),
                     callback=self.settings_changed,
                     contentsLength=3)

        gui.spin(widget=middle_box,
                 master=self,
                 value="beam_width",
                 minv=1,
                 maxv=100,
                 step=1,
                 label="Beam width:",
                 orientation=Qt.Horizontal,
                 callback=self.settings_changed,
                 alignment=Qt.AlignRight,
                 controlWidth=80)

        # bottom-level search procedure (over-fitting avoidance bias)
        bottom_box = gui.vBox(widget=self.controlArea, box="Rule filtering")

        gui.spin(widget=bottom_box,
                 master=self,
                 value="min_covered_examples",
                 minv=1,
                 maxv=10000,
                 step=1,
                 label="Minimum rule coverage:",
                 orientation=Qt.Horizontal,
                 callback=self.settings_changed,
                 alignment=Qt.AlignRight,
                 controlWidth=80)

        gui.spin(widget=bottom_box,
                 master=self,
                 value="max_rule_length",
                 minv=1,
                 maxv=100,
                 step=1,
                 label="Maximum rule length:",
                 orientation=Qt.Horizontal,
                 callback=self.settings_changed,
                 alignment=Qt.AlignRight,
                 controlWidth=80)

        gui.doubleSpin(widget=bottom_box,
                       master=self,
                       value="default_alpha",
                       minv=0.0,
                       maxv=1.0,
                       step=0.01,
                       label="Statistical significance\n(default α):",
                       orientation=Qt.Horizontal,
                       callback=self.settings_changed,
                       alignment=Qt.AlignRight,
                       controlWidth=80,
                       checked="checked_default_alpha")

        gui.doubleSpin(widget=bottom_box,
                       master=self,
                       value="parent_alpha",
                       minv=0.0,
                       maxv=1.0,
                       step=0.01,
                       label="Relative significance\n(parent α):",
                       orientation=Qt.Horizontal,
                       callback=self.settings_changed,
                       alignment=Qt.AlignRight,
                       controlWidth=80,
                       checked="checked_parent_alpha")
コード例 #41
0
 def test_checked_extension(self):
     widget = OWWidget()
     widget.some_param = 0
     widget.some_option = False
     gui.doubleSpin(widget=widget, master=widget, value="some_param",
                    minv=1, maxv=10, checked="some_option")
コード例 #42
0
    def __init__(self):
        super().__init__()

        self.data = None
        self.preprocessors = None
        self.learner = None
        self.scatterplot_item = None
        self.plot_item = None

        self.x_label = 'x'
        self.y_label = 'y'

        box = gui.widgetBox(self.controlArea, "Learner/Predictor Name")
        gui.lineEdit(box, self, "learner_name")

        box = gui.widgetBox(self.controlArea, "Variables")

        self.x_var_model = itemmodels.VariableListModel()
        self.comboBoxAttributesX = gui.comboBox(box,
                                                self,
                                                value='x_var_index',
                                                label="Input ",
                                                orientation="horizontal",
                                                callback=self.apply,
                                                contentsLength=12)
        self.comboBoxAttributesX.setSizePolicy(
            QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
        self.comboBoxAttributesX.setModel(self.x_var_model)
        gui.doubleSpin(gui.indentedBox(box),
                       self,
                       "polynomialexpansion",
                       0,
                       10,
                       label="Polynomial expansion:",
                       callback=self.apply)

        gui.separator(box, height=8)
        self.y_var_model = itemmodels.VariableListModel()
        self.comboBoxAttributesY = gui.comboBox(box,
                                                self,
                                                value='y_var_index',
                                                label='Target',
                                                orientation="horizontal",
                                                callback=self.apply,
                                                contentsLength=12)
        self.comboBoxAttributesY.setSizePolicy(
            QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Fixed)
        self.comboBoxAttributesY.setModel(self.y_var_model)

        gui.rubber(self.controlArea)

        # main area GUI
        self.plotview = pg.PlotWidget(background="w")
        self.plot = self.plotview.getPlotItem()

        axis_color = self.palette().color(QtGui.QPalette.Text)
        axis_pen = QtGui.QPen(axis_color)

        tickfont = QtGui.QFont(self.font())
        tickfont.setPixelSize(max(int(tickfont.pixelSize() * 2 // 3), 11))

        axis = self.plot.getAxis("bottom")
        axis.setLabel(self.x_label)
        axis.setPen(axis_pen)
        axis.setTickFont(tickfont)

        axis = self.plot.getAxis("left")
        axis.setLabel(self.y_label)
        axis.setPen(axis_pen)
        axis.setTickFont(tickfont)

        self.plot.setRange(xRange=(0.0, 1.0),
                           yRange=(0.0, 1.0),
                           disableAutoRange=True)

        self.mainArea.layout().addWidget(self.plotview)

        self.apply()
コード例 #43
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,
            'n_clusters',
            label=
            'Number of clusters to form as well as the number of centroids to generate. (IntVariable)',
            callback=None)

        gui.doubleSpin(
            box,
            self,
            "alpha",
            minv=0.5,
            maxv=1.,
            step=0.01,
            label=
            "Coefficient for deciding small and large clusters. [0.5,1.].",
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        gui.lineEdit(
            box,
            self,
            'beta',
            label=
            'Coefficient for deciding small and large clusters. (IntVariable)',
            callback=None)

        gui.checkBox(
            box,
            self,
            "use_weights",
            label=
            'Size of clusters used as weights in outlier score calculation.',
            callback=None)

        gui.checkBox(
            box,
            self,
            "check_estimator",
            label=
            'Check whether the base estimator is consistent with sklearn standard.',
            callback=None)

        gui.lineEdit(
            box,
            self,
            'random_state',
            label=
            'The seed used by the random number generator. (IntVariable or None)',
            callback=None)

        gui.doubleSpin(
            box,
            self,
            "contamination",
            minv=0.,
            maxv=1.,
            step=0.001,
            label="Input contamination, float in (0,0.5].",
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        # return_subseq_inds = Setting(False)
        gui.checkBox(box,
                     self,
                     "return_subseq_inds",
                     label='If return subsequence index.',
                     callback=None)

        # use_semantic_types = Setting(False)
        gui.checkBox(box,
                     self,
                     "use_semantic_types",
                     label='Mannally select columns if active.',
                     callback=None)

        # use_columns = Setting(())
        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)

        # exclude_columns = Setting(())
        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)

        # return_result = Setting(['append', 'replace', 'new'])
        gui.comboBox(
            box,
            self,
            "return_result",
            sendSelectedValue=True,
            label='Output results.',
            items=['new', 'append', 'replace'],
        )

        # add_index_columns = Setting(False)
        gui.checkBox(box,
                     self,
                     "add_index_columns",
                     label='Keep index in the outputs.',
                     callback=None)

        # error_on_no_input = Setting(True)
        gui.checkBox(box,
                     self,
                     "error_on_no_input",
                     label='Error on no input.',
                     callback=None)

        # return_semantic_type = Setting(['https://metadata.datadrivendiscovery.org/types/Attribute',
        #                                 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'])
        gui.comboBox(
            box,
            self,
            "return_semantic_type",
            sendSelectedValue=True,
            label='Semantic type attach with results.',
            items=[
                'https://metadata.datadrivendiscovery.org/types/Attribute',
                'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'
            ],
        )
        # Only for test
        gui.button(box,
                   self,
                   "Print Hyperparameters",
                   callback=self._print_hyperparameter)

        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)
コード例 #44
0
    def __init__(self, parent=None):
        super().__init__(self, parent)

        self.input_data = None
        self.ref_data = None
        self.ontology = None
        self.annotations = None
        self.loaded_annotation_code = None
        self.treeStructRootKey = None
        self.probFunctions = [statistics.Binomial(), statistics.Hypergeometric()]
        self.selectedTerms = []

        self.selectionChanging = 0
        self.__state = State.Ready
        self.__scheduletimer = QTimer(self, singleShot=True)
        self.__scheduletimer.timeout.connect(self.__update)

        #############
        # GUI
        #############
        self.tabs = gui.tabWidget(self.controlArea)
        # Input tab
        self.inputTab = gui.createTabPage(self.tabs, "Input")
        box = gui.widgetBox(self.inputTab, "Info")
        self.infoLabel = gui.widgetLabel(box, "No data on input\n")

        gui.button(box, self, "Ontology/Annotation Info",
                   callback=self.ShowInfo,
                   tooltip="Show information on loaded ontology and annotations")

        self.referenceRadioBox = gui.radioButtonsInBox(
            self.inputTab, self, "useReferenceDataset",
            ["Entire genome", "Reference set (input)"],
            tooltips=["Use entire genome for reference",
                      "Use genes from Referece Examples input signal as reference"],
            box="Reference", callback=self.__invalidate)

        self.referenceRadioBox.buttons[1].setDisabled(True)
        gui.radioButtonsInBox(
            self.inputTab, self, "aspectIndex",
            ["Biological process", "Cellular component", "Molecular function"],
            box="Aspect", callback=self.__invalidate)

        # Filter tab
        self.filterTab = gui.createTabPage(self.tabs, "Filter")
        box = gui.widgetBox(self.filterTab, "Filter GO Term Nodes")
        gui.checkBox(box, self, "filterByNumOfInstances", "Genes",
                     callback=self.FilterAndDisplayGraph,
                     tooltip="Filter by number of input genes mapped to a term")
        ibox = gui.indentedBox(box)
        gui.spin(ibox, self, 'minNumOfInstances', 1, 100,
                 step=1, label='#:', labelWidth=15,
                 callback=self.FilterAndDisplayGraph,
                 callbackOnReturn=True,
                 tooltip="Min. number of input genes mapped to a term")

        gui.checkBox(box, self, "filterByPValue_nofdr", "p-value",
                     callback=self.FilterAndDisplayGraph,
                     tooltip="Filter by term p-value")

        gui.doubleSpin(gui.indentedBox(box), self, 'maxPValue_nofdr', 1e-8, 1,
                       step=1e-8,  label='p:', labelWidth=15,
                       callback=self.FilterAndDisplayGraph,
                       callbackOnReturn=True,
                       tooltip="Max term p-value")

        # use filterByPValue for FDR, as it was the default in prior versions
        gui.checkBox(box, self, "filterByPValue", "FDR",
                     callback=self.FilterAndDisplayGraph,
                     tooltip="Filter by term FDR")
        gui.doubleSpin(gui.indentedBox(box), self, 'maxPValue', 1e-8, 1,
                       step=1e-8,  label='p:', labelWidth=15,
                       callback=self.FilterAndDisplayGraph,
                       callbackOnReturn=True,
                       tooltip="Max term p-value")

        box = gui.widgetBox(box, "Significance test")

        gui.radioButtonsInBox(box, self, "probFunc", ["Binomial", "Hypergeometric"],
                              tooltips=["Use binomial distribution test",
                                        "Use hypergeometric distribution test"],
                              callback=self.__invalidate)  # TODO: only update the p values
        box = gui.widgetBox(self.filterTab, "Evidence codes in annotation",
                              addSpace=True)
        self.evidenceCheckBoxDict = {}
        for etype in go.evidenceTypesOrdered:
            ecb = QCheckBox(
                etype, toolTip=go.evidenceTypes[etype],
                checked=self.useEvidenceType[etype])
            ecb.toggled.connect(self.__on_evidenceChanged)
            box.layout().addWidget(ecb)
            self.evidenceCheckBoxDict[etype] = ecb

        # Select tab
        self.selectTab = gui.createTabPage(self.tabs, "Select")
        box = gui.radioButtonsInBox(
            self.selectTab, self, "selectionDirectAnnotation",
            ["Directly or Indirectly", "Directly"],
            box="Annotated genes",
            callback=self.ExampleSelection)

        box = gui.widgetBox(self.selectTab, "Output", addSpace=True)
        gui.radioButtonsInBox(
            box, self, "selectionDisjoint",
            btnLabels=["All selected genes",
                       "Term-specific genes",
                       "Common term genes"],
            tooltips=["Outputs genes annotated to all selected GO terms",
                      "Outputs genes that appear in only one of selected GO terms",
                      "Outputs genes common to all selected GO terms"],
            callback=self.ExampleSelection)

        # ListView for DAG, and table for significant GOIDs
        self.DAGcolumns = ['GO term', 'Cluster', 'Reference', 'p-value',
                           'FDR', 'Genes', 'Enrichment']

        self.splitter = QSplitter(Qt.Vertical, self.mainArea)
        self.mainArea.layout().addWidget(self.splitter)

        # list view
        self.listView = GOTreeWidget(self.splitter)
        self.listView.setSelectionMode(QTreeView.ExtendedSelection)
        self.listView.setAllColumnsShowFocus(1)
        self.listView.setColumnCount(len(self.DAGcolumns))
        self.listView.setHeaderLabels(self.DAGcolumns)

        self.listView.header().setSectionsClickable(True)
        self.listView.header().setSortIndicatorShown(True)
        self.listView.header().setSortIndicator(self.DAGcolumns.index('p-value'), Qt.AscendingOrder)
        self.listView.setSortingEnabled(True)
        self.listView.setItemDelegateForColumn(
            6, EnrichmentColumnItemDelegate(self))
        self.listView.setRootIsDecorated(True)

        self.listView.itemSelectionChanged.connect(self.ViewSelectionChanged)

        # table of significant GO terms
        self.sigTerms = QTreeWidget(self.splitter)
        self.sigTerms.setColumnCount(len(self.DAGcolumns))
        self.sigTerms.setHeaderLabels(self.DAGcolumns)
        self.sigTerms.setSortingEnabled(True)
        self.sigTerms.setSelectionMode(QTreeView.ExtendedSelection)
        self.sigTerms.header().setSortIndicator(self.DAGcolumns.index('p-value'), Qt.AscendingOrder)
        self.sigTerms.setItemDelegateForColumn(
            6, EnrichmentColumnItemDelegate(self))

        self.sigTerms.itemSelectionChanged.connect(self.TableSelectionChanged)

        self.sigTableTermsSorted = []
        self.graph = {}
        self.originalGraph = None

        self.inputTab.layout().addStretch(1)
        self.filterTab.layout().addStretch(1)
        self.selectTab.layout().addStretch(1)

        class AnnotationSlot(SimpleNamespace):
            taxid = ...  # type: str
            name = ...   # type: str
            filename = ...  # type:str

            @staticmethod
            def parse_tax_id(f_name):
                return f_name.split('.')[1]

        try:
            remote_files = serverfiles.ServerFiles().listfiles(DOMAIN)
        except (ConnectTimeout, RequestException, ConnectionError):
            # TODO: Warn user about failed connection to the remote server
            remote_files = []

        self.available_annotations = [
            AnnotationSlot(
                taxid=AnnotationSlot.parse_tax_id(annotation_file),
                name=taxonomy.common_taxid_to_name(AnnotationSlot.parse_tax_id(annotation_file)),
                filename=FILENAME_ANNOTATION.format(AnnotationSlot.parse_tax_id(annotation_file))
            )
            for _, annotation_file in set(remote_files + serverfiles.listfiles(DOMAIN))
            if annotation_file != FILENAME_ONTOLOGY

        ]
        self._executor = ThreadExecutor()
コード例 #45
0
    def add_main_layout(self):
        def add_form(box):
            gui.separator(box)
            box2 = gui.hBox(box)
            gui.rubber(box2)
            form = 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]

        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]

        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]
コード例 #46
0
ファイル: OWPyodHBOS.py プロジェクト: lhenry15/tods-gui
    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,
            'n_bins',
            label='The number of bins for the histogram. (IntVariable)',
            callback=None)

        gui.doubleSpin(
            box,
            self,
            "alpha",
            minv=0.,
            maxv=1.,
            step=0.001,
            label="The regularizer for preventing overflow.",
        )

        gui.doubleSpin(
            box,
            self,
            "tol",
            minv=0.,
            maxv=1.,
            step=0.001,
            label=
            "The parameter to decide the flexibility while dealing the samples falling outside the bins.",
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        gui.doubleSpin(
            box,
            self,
            "contamination",
            minv=0.,
            maxv=1.,
            step=0.001,
            label="Input contamination, float in (0,0.5].",
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        # return_subseq_inds = Setting(False)
        gui.checkBox(box,
                     self,
                     "return_subseq_inds",
                     label='If return subsequence index.',
                     callback=None)

        # use_semantic_types = Setting(False)
        gui.checkBox(box,
                     self,
                     "use_semantic_types",
                     label='Mannally select columns if active.',
                     callback=None)

        # use_columns = Setting(())
        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)

        # exclude_columns = Setting(())
        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)

        # return_result = Setting(['append', 'replace', 'new'])
        gui.comboBox(
            box,
            self,
            "return_result",
            sendSelectedValue=True,
            label='Output results.',
            items=['new', 'append', 'replace'],
        )

        # add_index_columns = Setting(False)
        gui.checkBox(box,
                     self,
                     "add_index_columns",
                     label='Keep index in the outputs.',
                     callback=None)

        # error_on_no_input = Setting(True)
        gui.checkBox(box,
                     self,
                     "error_on_no_input",
                     label='Error on no input.',
                     callback=None)

        # return_semantic_type = Setting(['https://metadata.datadrivendiscovery.org/types/Attribute',
        #                                 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'])
        gui.comboBox(
            box,
            self,
            "return_semantic_type",
            sendSelectedValue=True,
            label='Semantic type attach with results.',
            items=[
                'https://metadata.datadrivendiscovery.org/types/Attribute',
                'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'
            ],
        )
        # Only for test
        # gui.button(box, self, "Print Hyperparameters", callback=self._print_hyperparameter)

        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)
コード例 #47
0
ファイル: OWCOF.py プロジェクト: lhenry15/tods-gui
    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.doubleSpin(
            box,
            self,
            "contamination",
            minv=0.,
            maxv=1.,
            step=0.001,
            label="Input contamination, float in (0,0.5].",
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        # use_semantic_types = Setting(False)
        gui.checkBox(box,
                     self,
                     "use_semantic_types",
                     label='Mannally select columns if active.',
                     callback=None)

        # use_columns = Setting(())
        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)

        # exclude_columns = Setting(())
        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)

        # return_result = Setting(['append', 'replace', 'new'])
        gui.comboBox(
            box,
            self,
            "return_result",
            sendSelectedValue=True,
            label='Output results.',
            items=['new', 'append', 'replace'],
        )

        # add_index_columns = Setting(False)
        gui.checkBox(box,
                     self,
                     "add_index_columns",
                     label='Keep index in the outputs.',
                     callback=None)

        # error_on_no_input = Setting(True)
        gui.checkBox(box,
                     self,
                     "error_on_no_input",
                     label='Error on no input.',
                     callback=None)

        # return_semantic_type = Setting(['https://metadata.datadrivendiscovery.org/types/Attribute',
        #                                 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'])
        gui.comboBox(
            box,
            self,
            "return_semantic_type",
            sendSelectedValue=True,
            label='Semantic type attach with results.',
            items=[
                'https://metadata.datadrivendiscovery.org/types/Attribute',
                'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'
            ],
        )
        # Only for test
        gui.button(box,
                   self,
                   "Print Hyperparameters",
                   callback=self._print_hyperparameter)

        self.data = None
        self.info.set_input_summary(self.info.NoInput)
        self.info.set_output_summary(self.info.NoOutput)
コード例 #48
0
    def __init__(self, parent=None):
        super().__init__(parent)

        self.data = None
        self.preprocessors = None

        box = gui.widgetBox(self.controlArea, self.tr("Name"))
        gui.lineEdit(box, self, "learner_name")

        form = QGridLayout()
        typebox = gui.radioButtonsInBox(
            self.controlArea,
            self,
            "lossfunc",
            [],
            orientation=form,
        )

        # Loss function control
        box = gui.widgetBox(self.controlArea,
                            self.tr("Loss function to be used"))
        buttonbox = gui.radioButtonsInBox(box,
                                          self,
                                          "loss_function",
                                          btnLabels=[
                                              "Squared loss", "Huber",
                                              "Epsilon insensitive",
                                              "Squared Epsilon insensitive"
                                          ],
                                          callback=self._on_func_changed)

        parambox = gui.widgetBox(box, orientation="horizontal")

        box = gui.widgetBox(self.controlArea, self.tr("Penalty"))
        buttonbox = gui.radioButtonsInBox(box,
                                          self,
                                          "penalty_type",
                                          btnLabels=[
                                              "Absolute norm (L1)",
                                              "Euclidean norm (L2)",
                                              "Elastic Net (both)"
                                          ],
                                          callback=self._on_penalty_changed)

        parambox = gui.widgetBox(box, orientation="horizontal")

        box = gui.widgetBox(self.controlArea, self.tr("Learning rate"))
        buttonbox = gui.radioButtonsInBox(
            box,
            self,
            "learning_rate",
            btnLabels=["Inverse scaling", "Constant"],
            callback=self._on_lrate_changed)

        box = gui.widgetBox(self.controlArea, self.tr("Constants"))

        form = QtGui.QFormLayout()
        form.setContentsMargins(0, 0, 0, 0)

        box.layout().addLayout(form)

        alpha = gui.doubleSpin(box, self, "alpha", 0.0, 10.0, step=0.0001)
        form.addRow("Alpha:", alpha)

        spin = gui.doubleSpin(box, self, "eta0", 0.0, 10, step=0.01)
        form.addRow("Eta0:", spin)

        epsilon = gui.doubleSpin(box, self, "epsilon", 0.0, 10.0, step=0.01)
        form.addRow("Epsilon:", epsilon)

        l1_ratio = gui.doubleSpin(box, self, "l1_ratio", 0.0, 10.0, step=0.01)
        form.addRow("L1 ratio:", l1_ratio)

        power_t = gui.doubleSpin(box, self, "power_t", 0.0, 10.0, step=0.01)
        form.addRow("Power t:", power_t)

        # Number of iterations control
        box = gui.widgetBox(self.controlArea, "Number of iterations")
        gui.doubleSpin(box, self, "n_iter", 0, 1e+6, step=1)

        self._func_params = [epsilon]
        self._penalty_params = [l1_ratio]
        self._lrate_params = [power_t]

        gui.button(self.controlArea,
                   self,
                   "&Apply",
                   callback=self.apply,
                   default=True)

        self.setSizePolicy(
            QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                              QtGui.QSizePolicy.Fixed))

        self.setMinimumWidth(300)

        self._on_func_changed()

        self.apply()
コード例 #49
0
 def __add_annotation_controls(self):
     common_options = {
         'labelWidth': 100,
         'orientation': Qt.Horizontal,
         'sendSelectedValue': True,
         'valueType': str,
         'contentsLength': 14,
     }
     box = gui.vBox(self.controlArea, True)
     ord = (DomainModel.METAS, DomainModel.ATTRIBUTES, DomainModel.CLASSES)
     mod = DomainModel(ord, valid_types=ContinuousVariable)
     gui.comboBox(box,
                  self,
                  "attr_x",
                  label="Axis x:",
                  model=mod,
                  callback=self.__axis_attr_changed,
                  **common_options)
     gui.comboBox(box,
                  self,
                  "attr_y",
                  label="Axis y:",
                  model=mod,
                  callback=self.__axis_attr_changed,
                  **common_options)
     gui.comboBox(
         box,
         self,
         "scoring_method",
         label="Scoring method:",
         items=ScoringMethod.items(),
         orientation=Qt.Horizontal,
         contentsLength=13,
         labelWidth=100,
         callback=self.__scoring_combo_changed,
     )
     gui.comboBox(
         box,
         self,
         "statistical_test",
         label="Statistical test:",
         items=StatisticalTest.items(),
         orientation=Qt.Horizontal,
         labelWidth=100,
         callback=self.__scoring_combo_changed,
     )
     gui.doubleSpin(box,
                    self,
                    "p_threshold",
                    0,
                    1,
                    0.01,
                    label="FDR threshold:",
                    callback=self.__p_threshold_changed)
     hbox = gui.hBox(box)
     gui.checkBox(hbox,
                  self,
                  "use_user_epsilon",
                  "ε for DBSCAN:",
                  callback=self.__epsilon_check_changed)
     self.epsilon_spin = gui.doubleSpin(hbox,
                                        self,
                                        "epsilon",
                                        0,
                                        10,
                                        0.1,
                                        callback=self.__epsilon_changed)
     self.run_button = gui.button(box, self, "Start", self._toggle_run)
コード例 #50
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.comboBox(
            box, self, 'kernel', label='Specifies the kernel type to be used in the algorithm.', items=['linear', 'poly', 'rbf', 'sigmoid', 'precomputed'], callback=None)

        gui.doubleSpin(
            box, self,
            "nu",
            minv=0.,
            maxv=1.,
            step=0.01,
            label="Upper bound on the fraction of training errors/Lower bound of the fraction of support vectors.",
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        gui.lineEdit(box, self, 'degree', label='Degree of the polynomial kernel function. (IntVariable)', callback=None)

        gui.lineEdit(box, self, 'gamma', label='Kernel coefficient for rbf, poly and sigmoid. (Float or auto)', callback=None)

        gui.lineEdit(box, self, 'coef0', label='Independent term in kernel function. (Float)', callback=None)

        gui.lineEdit(box, self, 'tol', label='Tolerance for stopping criterion. (Float)', callback=None)

        gui.checkBox(box, self, "shrinking", label='Whether to use the shrinking heuristic.',  callback=None)

        gui.lineEdit(box, self, 'cache_size', label='Specify the size of the kernel cache (in MB). (IntVariable)', callback=None)

        gui.checkBox(box, self, "verbose", label='Enable verbose output.',  callback=None)

        gui.lineEdit(box, self, 'max_iter', label='Hard limit on iterations within solver. (IntVariable)', callback=None)

        gui.doubleSpin(
            box, self,
            "contamination",
            minv=0.,
            maxv=1.,
            step=0.001,
            label="Input contamination, float in (0,0.5].",
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        # return_subseq_inds = Setting(False)
        gui.checkBox(box, self, "return_subseq_inds", label='If return subsequence index.',  callback=None)

        # use_semantic_types = Setting(False)
        gui.checkBox(box, self, "use_semantic_types", label='Mannally select columns if active.',  callback=None)

        # use_columns = Setting(())
        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)

        # exclude_columns = Setting(())
        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)

        # return_result = Setting(['append', 'replace', 'new'])
        gui.comboBox(box, self, "return_result", sendSelectedValue=True, label='Output results.', items=['new', 'append', 'replace'], )

        # add_index_columns = Setting(False)
        gui.checkBox(box, self, "add_index_columns", label='Keep index in the outputs.',  callback=None)

        # error_on_no_input = Setting(True)
        gui.checkBox(box, self, "error_on_no_input", label='Error on no input.',  callback=None)

        # return_semantic_type = Setting(['https://metadata.datadrivendiscovery.org/types/Attribute',
        #                                 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'])
        gui.comboBox(box, self, "return_semantic_type", sendSelectedValue=True, label='Semantic type attach with results.', items=['https://metadata.datadrivendiscovery.org/types/Attribute',
                                                                                        'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'], )
        # Only for test
        gui.button(box, self, "Print Hyperparameters", callback=self._print_hyperparameter)

        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)
コード例 #51
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,
            'n_estimators',
            label='Number of base estimators in the ensemble. (IntVariable)',
            callback=None)

        gui.comboBox(
            box,
            self,
            'max_samples',
            label=
            'Number of samples to draw from training data for each base estimator.',
            items=['auto', 'int', 'float'],
            callback=None)

        gui.lineEdit(
            box,
            self,
            'max_features',
            label=
            'Number of features to draw from training data for each base estimator. (Float)',
            callback=None)

        gui.checkBox(box,
                     self,
                     "bootstrap",
                     label='Fit on random subsets of training data.',
                     callback=None)

        gui.lineEdit(
            box,
            self,
            'random_state',
            label='Seed used by the random number generator. (Int or None)',
            callback=None)

        gui.lineEdit(
            box,
            self,
            'verbose',
            label=
            'Controls the verbosity of the tree building process. (IntVariable)',
            callback=None)

        gui.doubleSpin(
            box,
            self,
            "contamination",
            minv=0.,
            maxv=1.,
            step=0.001,
            label="Input contamination, float in (0,0.5].",
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        # return_subseq_inds = Setting(False)
        gui.checkBox(box,
                     self,
                     "return_subseq_inds",
                     label='If return subsequence index.',
                     callback=None)

        # use_semantic_types = Setting(False)
        gui.checkBox(box,
                     self,
                     "use_semantic_types",
                     label='Mannally select columns if active.',
                     callback=None)

        # use_columns = Setting(())
        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)

        # exclude_columns = Setting(())
        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)

        # return_result = Setting(['append', 'replace', 'new'])
        gui.comboBox(
            box,
            self,
            "return_result",
            sendSelectedValue=True,
            label='Output results.',
            items=['new', 'append', 'replace'],
        )

        # add_index_columns = Setting(False)
        gui.checkBox(box,
                     self,
                     "add_index_columns",
                     label='Keep index in the outputs.',
                     callback=None)

        # error_on_no_input = Setting(True)
        gui.checkBox(box,
                     self,
                     "error_on_no_input",
                     label='Error on no input.',
                     callback=None)

        # return_semantic_type = Setting(['https://metadata.datadrivendiscovery.org/types/Attribute',
        #                                 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'])
        gui.comboBox(
            box,
            self,
            "return_semantic_type",
            sendSelectedValue=True,
            label='Semantic type attach with results.',
            items=[
                'https://metadata.datadrivendiscovery.org/types/Attribute',
                'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'
            ],
        )
        # Only for test
        # gui.button(box, self, "Print Hyperparameters", callback=self._print_hyperparameter)

        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)
コード例 #52
0
ファイル: owrules.py プロジェクト: chenso121/orange3
    def add_main_layout(self):
        # top-level control procedure
        top_box = gui.hBox(widget=self.controlArea, box=None, addSpace=2)

        rule_ordering_box = gui.hBox(widget=top_box, box="规则排序")
        rule_ordering_rbs = gui.radioButtons(
            widget=rule_ordering_box, master=self, value="rule_ordering",
            callback=self.settings_changed, btnLabels=("有序的", "无序的"))
        rule_ordering_rbs.layout().setSpacing(7)

        covering_algorithm_box = gui.hBox(
            widget=top_box, box="覆盖算法(Covering algorithm)")
        covering_algorithm_rbs = gui.radioButtons(
            widget=covering_algorithm_box, master=self,
            value="covering_algorithm",
            callback=self.settings_changed,
            btnLabels=("互斥的(Exclusive)", "加权(Weighted)"))
        covering_algorithm_rbs.layout().setSpacing(7)

        insert_gamma_box = gui.vBox(widget=covering_algorithm_box, box=None)
        gui.separator(insert_gamma_box, 0, 14)
        self.gamma_spin = gui.doubleSpin(
            widget=insert_gamma_box, master=self, value="gamma", minv=0.0,
            maxv=1.0, step=0.01, label="γ:", orientation=Qt.Horizontal,
            callback=self.settings_changed, alignment=Qt.AlignRight,
            enabled=self.storage_covers[self.covering_algorithm] == "weighted")

        # bottom-level search procedure (search bias)
        middle_box = gui.vBox(widget=self.controlArea, box="规则搜索")

        gui.comboBox(
            widget=middle_box, master=self, value="evaluation_measure",
            label="评价措施:", orientation=Qt.Horizontal,
            items=("熵值(Entropy)", "拉普拉斯精度(Laplace accuracy)", "WRAcc"),
            callback=self.settings_changed, contentsLength=3)

        gui.spin(
            widget=middle_box, master=self, value="beam_width", minv=1,
            maxv=100, step=1, label="集束宽度(Beam width):", orientation=Qt.Horizontal,
            callback=self.settings_changed, alignment=Qt.AlignRight,
            controlWidth=80)

        # bottom-level search procedure (over-fitting avoidance bias)
        bottom_box = gui.vBox(widget=self.controlArea, box="规则筛选")

        gui.spin(
            widget=bottom_box, master=self, value="min_covered_examples", minv=1,
            maxv=10000, step=1, label="最小规则覆盖范围:",
            orientation=Qt.Horizontal, callback=self.settings_changed,
            alignment=Qt.AlignRight, controlWidth=80)

        gui.spin(
            widget=bottom_box, master=self, value="max_rule_length",
            minv=1, maxv=100, step=1, label="最大规则长度:",
            orientation=Qt.Horizontal, callback=self.settings_changed,
            alignment=Qt.AlignRight, controlWidth=80)

        gui.doubleSpin(
            widget=bottom_box, master=self, value="default_alpha", minv=0.0,
            maxv=1.0, step=0.01, label="统计显著性\n(默认 α):",
            orientation=Qt.Horizontal, callback=self.settings_changed,
            alignment=Qt.AlignRight, controlWidth=80,
            checked="checked_default_alpha")

        gui.doubleSpin(
            widget=bottom_box, master=self, value="parent_alpha", minv=0.0,
            maxv=1.0, step=0.01, label="相对显著性\n(父 α):",
            orientation=Qt.Horizontal, callback=self.settings_changed,
            alignment=Qt.AlignRight, controlWidth=80,
            checked="checked_parent_alpha")
コード例 #53
0
ファイル: owsvmregression.py プロジェクト: VesnaT/orange3
    def __init__(self, parent=None):
        super().__init__(parent)

        self.data = None
        self.preprocessors = None

        box = gui.widgetBox(self.controlArea, self.tr("Name"))
        gui.lineEdit(box, self, "learner_name")

        form = QGridLayout()
        typebox = gui.radioButtonsInBox(
            self.controlArea, self, "svrtype", [],
            box=self.tr("SVM Regression Type"),
            orientation=form,
        )

        eps_svr = gui.appendRadioButton(typebox, "ε-SVR", addToLayout=False)
        form.addWidget(eps_svr, 0, 0, Qt.AlignLeft)

        form.addWidget(QtGui.QLabel(self.tr("Cost (C)")), 0, 1, Qt.AlignRight)
        c_spin = gui.doubleSpin(
            typebox, self, "epsilon_C", 0.1, 512.0, 0.1,
            decimals=2, addToLayout=False
        )
        form.addWidget(c_spin, 0, 2)

        form.addWidget(QLabel("Loss Epsilon (ε)"), 1, 1, Qt.AlignRight)
        eps_spin = gui.doubleSpin(
            typebox, self, "epsilon",  0.1, 512.0, 0.1,
            decimals=2, addToLayout=False
        )
        form.addWidget(eps_spin, 1, 2)

        nu_svr = gui.appendRadioButton(typebox, "ν-SVR", addToLayout=False)
        form.addWidget(nu_svr, 2, 0, Qt.AlignLeft)

        form.addWidget(QLabel(self.tr("Cost (C)")), 2, 1, Qt.AlignRight)
        c_spin = gui.doubleSpin(
            typebox, self, "nu_C", 0.1, 512.0, 0.1,
            decimals=2, addToLayout=False
        )
        form.addWidget(c_spin, 2, 2)

        form.addWidget(QLabel("Complexity bound (ν)"),
                       3, 1, Qt.AlignRight)
        nu_spin = gui.doubleSpin(
            typebox, self, "nu", 0.05, 1.0, 0.05,
            decimals=2, addToLayout=False
        )
        form.addWidget(nu_spin, 3, 2)

        # Kernel control
        box = gui.widgetBox(self.controlArea, self.tr("Kernel"))
        buttonbox = gui.radioButtonsInBox(
            box, self, "kernel_type",
            btnLabels=["Linear,   x∙y",
                       "Polynomial,   (g x∙y + c)^d",
                       "RBF,   exp(-g|x-y|²)",
                       "Sigmoid,   tanh(g x∙y + c)"],
            callback=self._on_kernel_changed
        )
        parambox = gui.widgetBox(box, orientation="horizontal")
        gamma = gui.doubleSpin(
            parambox, self, "gamma", 0.0, 10.0, 0.0001,
            label=" g: ", orientation="horizontal",
            alignment=Qt.AlignRight
        )
        coef0 = gui.doubleSpin(
            parambox, self, "coef0", 0.0, 10.0, 0.0001,
            label=" c: ", orientation="horizontal",
            alignment=Qt.AlignRight
        )
        degree = gui.doubleSpin(
            parambox, self, "degree", 0.0, 10.0, 0.5,
            label=" d: ", orientation="horizontal",
            alignment=Qt.AlignRight
        )
        self._kernel_params = [gamma, coef0, degree]

        # Numerical tolerance control
        box = gui.widgetBox(self.controlArea, "Numerical Tolerance")
        gui.doubleSpin(box, self, "tol", 1e-7, 1e-3, 5e-7)

        gui.button(self.controlArea, self, "&Apply",
                   callback=self.apply, default=True)

        self.setSizePolicy(
            QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed,
                              QtGui.QSizePolicy.Fixed)
        )

        self.setMinimumWidth(300)

        self._on_kernel_changed()

        self.apply()
コード例 #54
0
ファイル: owsvm.py プロジェクト: zyblx/orange3
    def _add_type_box(self):
        # this is part of init, pylint: disable=attribute-defined-outside-init
        form = QGridLayout()
        self.type_box = box = gui.radioButtonsInBox(self.controlArea,
                                                    self,
                                                    "svm_type", [],
                                                    box="SVM Type",
                                                    orientation=form,
                                                    callback=self._update_type)

        self.epsilon_radio = gui.appendRadioButton(box,
                                                   "SVM",
                                                   addToLayout=False)
        self.c_spin = gui.doubleSpin(box,
                                     self,
                                     "C",
                                     0.1,
                                     512.0,
                                     0.1,
                                     decimals=2,
                                     alignment=Qt.AlignRight,
                                     addToLayout=False,
                                     callback=self.settings_changed)
        self.epsilon_spin = gui.doubleSpin(box,
                                           self,
                                           "epsilon",
                                           0.1,
                                           512.0,
                                           0.1,
                                           decimals=2,
                                           alignment=Qt.AlignRight,
                                           addToLayout=False,
                                           callback=self.settings_changed)
        form.addWidget(self.epsilon_radio, 0, 0, Qt.AlignLeft)
        form.addWidget(QLabel("Cost (C):"), 0, 1, Qt.AlignRight)
        form.addWidget(self.c_spin, 0, 2)
        form.addWidget(QLabel("Regression loss epsilon (ε):"), 1, 1,
                       Qt.AlignRight)
        form.addWidget(self.epsilon_spin, 1, 2)

        self.nu_radio = gui.appendRadioButton(box, "ν-SVM", addToLayout=False)
        self.nu_C_spin = gui.doubleSpin(box,
                                        self,
                                        "nu_C",
                                        0.1,
                                        512.0,
                                        0.1,
                                        decimals=2,
                                        alignment=Qt.AlignRight,
                                        addToLayout=False,
                                        callback=self.settings_changed)
        self.nu_spin = gui.doubleSpin(box,
                                      self,
                                      "nu",
                                      0.05,
                                      1.0,
                                      0.05,
                                      decimals=2,
                                      alignment=Qt.AlignRight,
                                      addToLayout=False,
                                      callback=self.settings_changed)
        form.addWidget(self.nu_radio, 2, 0, Qt.AlignLeft)
        form.addWidget(QLabel("Regression cost (C):"), 2, 1, Qt.AlignRight)
        form.addWidget(self.nu_C_spin, 2, 2)
        form.addWidget(QLabel("Complexity bound (ν):"), 3, 1, Qt.AlignRight)
        form.addWidget(self.nu_spin, 3, 2)

        # Correctly enable/disable the appropriate boxes
        self._update_type()
コード例 #55
0
    def __init__(self, parent=None):
        super().__init__(self, parent)

        self.clusterDataset = None
        self.referenceDataset = None
        self.ontology = None
        self.annotations = None
        self.loadedAnnotationCode = "---"
        self.treeStructRootKey = None
        self.probFunctions = [stats.Binomial(), stats.Hypergeometric()]
        self.selectedTerms = []

        self.selectionChanging = 0
        self.__state = OWGOEnrichmentAnalysis.Initializing

        self.annotationCodes = []

        #############
        ## GUI
        #############
        self.tabs = gui.tabWidget(self.controlArea)
        ## Input tab
        self.inputTab = gui.createTabPage(self.tabs, "Input")
        box = gui.widgetBox(self.inputTab, "Info")
        self.infoLabel = gui.widgetLabel(box, "No data on input\n")

        gui.button(box, self, "Ontology/Annotation Info",
                   callback=self.ShowInfo,
                   tooltip="Show information on loaded ontology and annotations")

        box = gui.widgetBox(self.inputTab, "Organism")
        self.annotationComboBox = gui.comboBox(
            box, self, "annotationIndex", items=self.annotationCodes,
            callback=self._updateEnrichment, tooltip="Select organism")

        genebox = gui.widgetBox(self.inputTab, "Gene Names")
        self.geneAttrIndexCombo = gui.comboBox(
            genebox, self, "geneAttrIndex", callback=self._updateEnrichment,
            tooltip="Use this attribute to extract gene names from input data")
        self.geneAttrIndexCombo.setDisabled(self.useAttrNames)

        cb = gui.checkBox(genebox, self, "useAttrNames", "Use column names",
                          tooltip="Use column names for gene names",
                          callback=self._updateEnrichment)
        cb.toggled[bool].connect(self.geneAttrIndexCombo.setDisabled)

        gui.button(genebox, self, "Gene matcher settings",
                   callback=self.UpdateGeneMatcher,
                   tooltip="Open gene matching settings dialog")

        self.referenceRadioBox = gui.radioButtonsInBox(
            self.inputTab, self, "useReferenceDataset",
            ["Entire genome", "Reference set (input)"],
            tooltips=["Use entire genome for reference",
                      "Use genes from Referece Examples input signal as reference"],
            box="Reference", callback=self._updateEnrichment)

        self.referenceRadioBox.buttons[1].setDisabled(True)
        gui.radioButtonsInBox(
            self.inputTab, self, "aspectIndex",
            ["Biological process", "Cellular component", "Molecular function"],
            box="Aspect", callback=self._updateEnrichment)

        ## Filter tab
        self.filterTab = gui.createTabPage(self.tabs, "Filter")
        box = gui.widgetBox(self.filterTab, "Filter GO Term Nodes")
        gui.checkBox(box, self, "filterByNumOfInstances", "Genes",
                     callback=self.FilterAndDisplayGraph, 
                     tooltip="Filter by number of input genes mapped to a term")
        ibox = gui.indentedBox(box)
        gui.spin(ibox, self, 'minNumOfInstances', 1, 100,
                 step=1, label='#:', labelWidth=15,
                 callback=self.FilterAndDisplayGraph,
                 callbackOnReturn=True,
                 tooltip="Min. number of input genes mapped to a term")

        gui.checkBox(box, self, "filterByPValue_nofdr", "p-value",
                     callback=self.FilterAndDisplayGraph,
                     tooltip="Filter by term p-value")

        gui.doubleSpin(gui.indentedBox(box), self, 'maxPValue_nofdr', 1e-8, 1,
                       step=1e-8,  label='p:', labelWidth=15,
                       callback=self.FilterAndDisplayGraph,
                       callbackOnReturn=True,
                       tooltip="Max term p-value")

        #use filterByPValue for FDR, as it was the default in prior versions
        gui.checkBox(box, self, "filterByPValue", "FDR",
                     callback=self.FilterAndDisplayGraph,
                     tooltip="Filter by term FDR")
        gui.doubleSpin(gui.indentedBox(box), self, 'maxPValue', 1e-8, 1,
                       step=1e-8,  label='p:', labelWidth=15,
                       callback=self.FilterAndDisplayGraph,
                       callbackOnReturn=True,
                       tooltip="Max term p-value")

        box = gui.widgetBox(box, "Significance test")

        gui.radioButtonsInBox(box, self, "probFunc", ["Binomial", "Hypergeometric"],
                              tooltips=["Use binomial distribution test",
                                        "Use hypergeometric distribution test"],
                              callback=self._updateEnrichment)
        box = gui.widgetBox(self.filterTab, "Evidence codes in annotation",
                              addSpace=True)
        self.evidenceCheckBoxDict = {}
        for etype in go.evidenceTypesOrdered:
            ecb = QCheckBox(
                etype, toolTip=go.evidenceTypes[etype],
                checked=self.useEvidenceType[etype])
            ecb.toggled.connect(self.__on_evidenceChanged)
            box.layout().addWidget(ecb)
            self.evidenceCheckBoxDict[etype] = ecb

        ## Select tab
        self.selectTab = gui.createTabPage(self.tabs, "Select")
        box = gui.radioButtonsInBox(
            self.selectTab, self, "selectionDirectAnnotation",
            ["Directly or Indirectly", "Directly"],
            box="Annotated genes",
            callback=self.ExampleSelection)

        box = gui.widgetBox(self.selectTab, "Output", addSpace=True)
        gui.radioButtonsInBox(
            box, self, "selectionDisjoint",
            btnLabels=["All selected genes",
                       "Term-specific genes",
                       "Common term genes"],
            tooltips=["Outputs genes annotated to all selected GO terms",
                      "Outputs genes that appear in only one of selected GO terms", 
                      "Outputs genes common to all selected GO terms"],
            callback=[self.ExampleSelection,
                      self.UpdateAddClassButton])

        self.addClassCB = gui.checkBox(
            box, self, "selectionAddTermAsClass", "Add GO Term as class",
            callback=self.ExampleSelection)

        # ListView for DAG, and table for significant GOIDs
        self.DAGcolumns = ['GO term', 'Cluster', 'Reference', 'p-value',
                           'FDR', 'Genes', 'Enrichment']

        self.splitter = QSplitter(Qt.Vertical, self.mainArea)
        self.mainArea.layout().addWidget(self.splitter)

        # list view
        self.listView = GOTreeWidget(self.splitter)
        self.listView.setSelectionMode(QTreeView.ExtendedSelection)
        self.listView.setAllColumnsShowFocus(1)
        self.listView.setColumnCount(len(self.DAGcolumns))
        self.listView.setHeaderLabels(self.DAGcolumns)

        self.listView.header().setSectionsClickable(True)
        self.listView.header().setSortIndicatorShown(True)
        self.listView.setSortingEnabled(True)
        self.listView.setItemDelegateForColumn(
            6, EnrichmentColumnItemDelegate(self))
        self.listView.setRootIsDecorated(True)

        self.listView.itemSelectionChanged.connect(self.ViewSelectionChanged)

        # table of significant GO terms
        self.sigTerms = QTreeWidget(self.splitter)
        self.sigTerms.setColumnCount(len(self.DAGcolumns))
        self.sigTerms.setHeaderLabels(self.DAGcolumns)
        self.sigTerms.setSortingEnabled(True)
        self.sigTerms.setSelectionMode(QTreeView.ExtendedSelection)
        self.sigTerms.setItemDelegateForColumn(
            6, EnrichmentColumnItemDelegate(self))

        self.sigTerms.itemSelectionChanged.connect(self.TableSelectionChanged)

        self.sigTableTermsSorted = []
        self.graph = {}

        self.inputTab.layout().addStretch(1)
        self.filterTab.layout().addStretch(1)
        self.selectTab.layout().addStretch(1)

        self.setBlocking(True)
        self._executor = ThreadExecutor()
        self._init = EnsureDownloaded(
            [(taxonomy.Taxonomy.DOMAIN, taxonomy.Taxonomy.FILENAME),
             ("GO", "taxonomy.pickle")]
        )
        self._init.finished.connect(self.__initialize_finish)
        self._executor.submit(self._init)
コード例 #56
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.comboBox(
            box,
            self,
            "unbiased",
            label=
            'Unbiased (If True, then denominators for autocovariance are n-k, otherwise n)',
            items=[False, True],
            sendSelectedValue=True,
            callback=self.settings_changed)
        gui.doubleSpin(
            box,
            self,
            'nlags',
            minv=0,
            maxv=100,  #TODO:Define upper bound correctly
            step=1,
            label="nlags (Number of lags to return autocorrelation for)",
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        gui.comboBox(
            box,
            self,
            'qstat',
            label=
            'qstat (If True, returns the Ljung-Box q statistic for each autocorrelationcoefficient)',
            items=[False, True],
            sendSelectedValue=True,
            callback=self.settings_changed)

        gui.comboBox(box,
                     self,
                     'fft',
                     label='fft (If True, computes the ACF via FFT)',
                     items=[False, True],
                     sendSelectedValue=True,
                     callback=self.settings_changed)

        gui.doubleSpin(
            box,
            self,
            'alpha',
            minv=0.,
            maxv=1.,
            step=0.001,
            label=
            """If a number is given, the confidence intervals for the given level are returned.
                    For instance if alpha=.05, 95 % confidence intervals are returned where the standard deviation is computed according to Bartlett"s formula.""",
            callback=self.settings_changed
            # callbackOnReturn = True,
            # checked = "BoundedFloat"
        )

        gui.comboBox(
            box,
            self,
            'missing',
            label=
            """Specifying how the NaNs are to be treated. "none" performs no checks. "raise" raises an exception if NaN values are found. 
                            "drop" removes the missing observations and then estimates the autocovariances treating the non-missing as contiguous. 
                            "conservative" computes the autocovariance using nan-ops so that nans are removed when computing the mean
                            and cross-products that are used to estimate the autocovariance.
                            When using "conservative", n is set to the number of non-missing observations.""",
            items=["none", "raise", "conservative", "drop"],
            sendSelectedValue=True,
            callback=self.settings_changed)

        # use_semantic_types = Setting(False)
        gui.checkBox(box,
                     self,
                     "use_semantic_types",
                     label='Mannally select columns if active.',
                     callback=self.settings_changed)

        # use_columns = Setting(())
        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)

        # exclude_columns = Setting(())
        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)

        # return_result = Setting(['append', 'replace', 'new'])
        gui.comboBox(box,
                     self,
                     "return_result",
                     sendSelectedValue=True,
                     label='Output results.',
                     items=['new', 'append', 'replace'],
                     callback=self.settings_changed)

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

        # error_on_no_input = Setting(True)
        gui.checkBox(box,
                     self,
                     "error_on_no_input",
                     label='Error on no input.',
                     callback=self.settings_changed)

        # return_semantic_type = Setting(['https://metadata.datadrivendiscovery.org/types/Attribute',
        #                                 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'])
        gui.comboBox(
            box,
            self,
            "return_semantic_type",
            sendSelectedValue=True,
            label='Semantic type attach with results.',
            items=[
                'https://metadata.datadrivendiscovery.org/types/Attribute',
                'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'
            ],
            callback=self.settings_changed)
        # Only for test
        #gui.button(box, self, "Print Hyperparameters", callback=self._print_hyperparameter)

        gui.auto_apply(box, self, "autosend", box=False)
コード例 #57
0
ファイル: owrules.py プロジェクト: lanzagar/orange3
    def add_main_layout(self):
        # top-level control procedure
        top_box = gui.hBox(widget=self.controlArea, box=None, addSpace=2)

        rule_ordering_box = gui.hBox(widget=top_box, box="Rule ordering")
        rule_ordering_rbs = gui.radioButtons(
            widget=rule_ordering_box, master=self, value="rule_ordering",
            callback=self.settings_changed, btnLabels=("Ordered", "Unordered"))
        rule_ordering_rbs.layout().setSpacing(7)

        covering_algorithm_box = gui.hBox(
            widget=top_box, box="Covering algorithm")
        covering_algorithm_rbs = gui.radioButtons(
            widget=covering_algorithm_box, master=self,
            value="covering_algorithm",
            callback=self.settings_changed,
            btnLabels=("Exclusive", "Weighted"))
        covering_algorithm_rbs.layout().setSpacing(7)

        insert_gamma_box = gui.vBox(widget=covering_algorithm_box, box=None)
        gui.separator(insert_gamma_box, 0, 14)
        self.gamma_spin = gui.doubleSpin(
            widget=insert_gamma_box, master=self, value="gamma", minv=0.0,
            maxv=1.0, step=0.01, label="γ:", orientation=Qt.Horizontal,
            callback=self.settings_changed, alignment=Qt.AlignRight,
            enabled=self.storage_covers[self.covering_algorithm] == "weighted")

        # bottom-level search procedure (search bias)
        middle_box = gui.vBox(widget=self.controlArea, box="Rule search")

        evaluation_measure_box = gui.comboBox(
            widget=middle_box, master=self, value="evaluation_measure",
            label="Evaluation measure:", orientation=Qt.Horizontal,
            items=("Entropy", "Laplace accuracy", "WRAcc"),
            callback=self.settings_changed, contentsLength=3)

        beam_width_box = gui.spin(
            widget=middle_box, master=self, value="beam_width", minv=1,
            maxv=100, step=1, label="Beam width:", orientation=Qt.Horizontal,
            callback=self.settings_changed, alignment=Qt.AlignRight,
            controlWidth=80)

        # bottom-level search procedure (over-fitting avoidance bias)
        bottom_box = gui.vBox(widget=self.controlArea, box="Rule filtering")

        min_covered_examples_box = gui.spin(
            widget=bottom_box, master=self, value="min_covered_examples", minv=1,
            maxv=10000, step=1, label="Minimum rule coverage:",
            orientation=Qt.Horizontal, callback=self.settings_changed,
            alignment=Qt.AlignRight, controlWidth=80)

        max_rule_length_box = gui.spin(
            widget=bottom_box, master=self, value="max_rule_length",
            minv=1, maxv=100, step=1, label="Maximum rule length:",
            orientation=Qt.Horizontal, callback=self.settings_changed,
            alignment=Qt.AlignRight, controlWidth=80)

        default_alpha_spin = gui.doubleSpin(
            widget=bottom_box, master=self, value="default_alpha", minv=0.0,
            maxv=1.0, step=0.01, label="Statistical significance\n(default α):",
            orientation=Qt.Horizontal, callback=self.settings_changed,
            alignment=Qt.AlignRight, controlWidth=80,
            checked="checked_default_alpha")

        parent_alpha_spin = gui.doubleSpin(
            widget=bottom_box, master=self, value="parent_alpha", minv=0.0,
            maxv=1.0, step=0.01, label="Relative significance\n(parent α):",
            orientation=Qt.Horizontal, callback=self.settings_changed,
            alignment=Qt.AlignRight, controlWidth=80,
            checked="checked_parent_alpha")
コード例 #58
0
    def addHistogramControls(self):
        boxGeneral = gui.widgetBox(self.controlArea, box="Edges")
        ribg = gui.widgetBox(boxGeneral,
                             None,
                             orientation="horizontal",
                             addSpace=False)
        self.spin_high = gui.doubleSpin(boxGeneral,
                                        self,
                                        'spinUpperThreshold',
                                        0,
                                        float('inf'),
                                        0.001,
                                        decimals=3,
                                        label='Distance threshold',
                                        callback=self.changeUpperSpin,
                                        keyboardTracking=False,
                                        controlWidth=60)
        self.histogram.region.sigRegionChangeFinished.connect(
            self.spinboxFromHistogramRegion)

        ribg = gui.widgetBox(boxGeneral,
                             None,
                             orientation="horizontal",
                             addSpace=False)

        gui.doubleSpin(boxGeneral,
                       self,
                       "percentil",
                       0,
                       100,
                       0.1,
                       label="Percentile",
                       orientation='horizontal',
                       callback=self.setPercentil,
                       callbackOnReturn=1,
                       controlWidth=60)

        hbox = gui.widgetBox(boxGeneral, orientation='horizontal')
        knn_cb = gui.checkBox(hbox,
                              self,
                              'include_knn',
                              label='Include closest neighbors',
                              callback=self.generateGraph)
        knn = gui.spin(hbox,
                       self,
                       "kNN",
                       1,
                       1000,
                       1,
                       orientation='horizontal',
                       callback=self.generateGraph,
                       callbackOnReturn=1,
                       controlWidth=60)
        knn_cb.disables = [knn]
        knn_cb.makeConsistent()

        ribg.layout().addStretch(1)
        # Options
        ribg = gui.radioButtonsInBox(self.controlArea,
                                     self,
                                     "node_selection",
                                     box="Node selection",
                                     callback=self.generateGraph)
        grid = QGridLayout()
        ribg.layout().addLayout(grid)
        grid.addWidget(
            gui.appendRadioButton(ribg, "Keep all nodes", addToLayout=False),
            0, 0)

        exclude_limit = gui.spin(
            ribg,
            self,
            "excludeLimit",
            2,
            100,
            1,
            callback=(lambda h=True: self.generateGraph(h)),
            controlWidth=60)
        grid.addWidget(
            gui.appendRadioButton(ribg,
                                  "Components with at least nodes",
                                  addToLayout=False), 1, 0)
        grid.addWidget(exclude_limit, 1, 1)

        grid.addWidget(
            gui.appendRadioButton(ribg,
                                  "Largest connected component",
                                  addToLayout=False), 2, 0)

        ribg = gui.radioButtonsInBox(self.controlArea,
                                     self,
                                     "edge_weights",
                                     box="Edge weights",
                                     callback=self.generateGraph)
        hb = gui.widgetBox(ribg,
                           None,
                           orientation="horizontal",
                           addSpace=False)
        gui.appendRadioButton(ribg, "Proportional to distance", insertInto=hb)
        gui.appendRadioButton(ribg, "Inverted distance", insertInto=hb)
コード例 #59
0
    def addHistogramControls(self):
        # gui.spin and gui.doubleSpin cannot not be inserted somewhere, thus
        # we insert them into controlArea and then move to grid
        grid = QGridLayout()
        gui.widgetBox(self.controlArea, box="Edges", orientation=grid)
        self.spin_high = gui.doubleSpin(self.controlArea,
                                        self,
                                        'spinUpperThreshold',
                                        0,
                                        float('inf'),
                                        0.001,
                                        decimals=3,
                                        callback=self.changeUpperSpin,
                                        keyboardTracking=False,
                                        controlWidth=60,
                                        addToLayout=False)
        grid.addWidget(QLabel("Distance threshold"), 0, 0)
        grid.addWidget(self.spin_high, 0, 1)

        self.histogram.region.sigRegionChangeFinished.connect(
            self.spinboxFromHistogramRegion)

        spin = gui.doubleSpin(self.controlArea,
                              self,
                              "percentil",
                              0,
                              100,
                              PERCENTIL_STEP,
                              label="Percentile",
                              orientation=Qt.Horizontal,
                              callback=self.setPercentil,
                              callbackOnReturn=1,
                              controlWidth=60)
        grid.addWidget(QLabel("Percentile"), 1, 0)
        grid.addWidget(spin, 1, 1)

        knn_cb = gui.checkBox(self.controlArea,
                              self,
                              'include_knn',
                              label='Include closest neighbors',
                              callback=self.generateGraph)
        knn = gui.spin(self.controlArea,
                       self,
                       "kNN",
                       1,
                       1000,
                       1,
                       orientation=Qt.Horizontal,
                       callback=self.generateGraph,
                       callbackOnReturn=1,
                       controlWidth=60)
        grid.addWidget(knn_cb, 2, 0)
        grid.addWidget(knn, 2, 1)

        knn_cb.disables = [knn]
        knn_cb.makeConsistent()

        # Options
        ribg = gui.radioButtonsInBox(self.controlArea,
                                     self,
                                     "node_selection",
                                     box="Node selection",
                                     callback=self.generateGraph)
        grid = QGridLayout()
        ribg.layout().addLayout(grid)
        grid.addWidget(
            gui.appendRadioButton(ribg, "Keep all nodes", addToLayout=False),
            0, 0)

        exclude_limit = gui.spin(
            ribg,
            self,
            "excludeLimit",
            2,
            100,
            1,
            callback=(lambda h=True: self.generateGraph(h)),
            controlWidth=60)
        grid.addWidget(
            gui.appendRadioButton(ribg,
                                  "Components with at least nodes",
                                  addToLayout=False), 1, 0)
        grid.addWidget(exclude_limit, 1, 1)

        grid.addWidget(
            gui.appendRadioButton(ribg,
                                  "Largest connected component",
                                  addToLayout=False), 2, 0)

        ribg = gui.radioButtonsInBox(self.controlArea,
                                     self,
                                     "edge_weights",
                                     box="Edge weights",
                                     callback=self.generateGraph)
        hb = gui.widgetBox(ribg, None, addSpace=False)
        gui.appendRadioButton(ribg, "Proportional to distance", insertInto=hb)
        gui.appendRadioButton(ribg, "Inverted distance", insertInto=hb)
コード例 #60
0
    def _init_ui(self):
        # implement your user interface here (for setting hyperparameters)
        gui.separator(self.controlArea)
        box1 = gui.widgetBox(self.controlArea, "Hyperparameter: Algorithm")
        box2 = gui.widgetBox(self.controlArea, "Hyperparameter: Columns")

        line1 = gui.widgetBox(
            box1,
            box=None,
            orientation=1,
            margin=None,
            spacing=20,
        )
        line2 = gui.widgetBox(
            box1,
            box=None,
            orientation=1,
            margin=None,
            spacing=20,
        )
        line3 = gui.widgetBox(
            box1,
            box=None,
            orientation=1,
            margin=None,
            spacing=20,
        )
        line4 = gui.widgetBox(
            box1,
            box=None,
            orientation=1,
            margin=None,
            spacing=20,
        )
        line5 = gui.widgetBox(
            box1,
            box=None,
            orientation=1,
            margin=None,
            spacing=20,
        )
        line6 = gui.widgetBox(
            box1,
            box=None,
            orientation=1,
            margin=None,
            spacing=20,
        )
        line7 = gui.widgetBox(
            box1,
            box=None,
            orientation=1,
            margin=None,
            spacing=20,
        )

        gui.lineEdit(line1,
                     self,
                     'hidden_size',
                     label='Hidden layer size of DeepLog network',
                     callback=self.settings_changed)
        gui.lineEdit(line1,
                     self,
                     'loss',
                     label='loss',
                     callback=self.settings_changed)
        gui.lineEdit(line2,
                     self,
                     'optimizer',
                     label='optimizer',
                     callback=self.settings_changed)
        gui.lineEdit(line2,
                     self,
                     'epochs',
                     label='epochs',
                     callback=self.settings_changed)
        gui.lineEdit(line3,
                     self,
                     'batch_size',
                     label='batch_size',
                     callback=self.settings_changed)
        gui.lineEdit(line3,
                     self,
                     'dropout_rate',
                     label='dropout_rate',
                     callback=self.settings_changed)
        gui.lineEdit(line4,
                     self,
                     'l2_regularizer',
                     label='l2_regularizer',
                     callback=self.settings_changed)
        gui.lineEdit(line4,
                     self,
                     'validation_size',
                     label='validation_size',
                     callback=self.settings_changed)
        gui.lineEdit(line5,
                     self,
                     'window_size',
                     label='window_size',
                     callback=self.settings_changed)
        gui.lineEdit(line5,
                     self,
                     'features',
                     label='features',
                     callback=self.settings_changed)
        gui.lineEdit(line6,
                     self,
                     'stacked_layers',
                     label='stacked_layers',
                     callback=self.settings_changed)
        gui.lineEdit(line6,
                     self,
                     'preprocessing',
                     label='preprocessing',
                     callback=self.settings_changed)
        gui.lineEdit(line7,
                     self,
                     'verbose',
                     label='verbose',
                     callback=self.settings_changed)
        # gui.comboBox(box, self, 'algorithm', label='Algorithm used to compute the nearest neighbors.',
        #              items=['auto', 'ball_tree', 'kd_tree', 'brute'], callback=None)

        gui.doubleSpin(line7,
                       self,
                       "contamination",
                       minv=0.,
                       maxv=1.,
                       step=0.001,
                       label="Input contamination, float in (0,0.5].",
                       callback=self.settings_changed
                       # callbackOnReturn = True,
                       # checked = "BoundedFloat"
                       )

        # return_subseq_inds = Setting(False)
        gui.checkBox(box2,
                     self,
                     "return_subseq_inds",
                     label='If return subsequence index.',
                     callback=self.settings_changed)

        # use_semantic_types = Setting(False)
        gui.checkBox(box2,
                     self,
                     "use_semantic_types",
                     label='Mannally select columns if active.',
                     callback=self.settings_changed)

        # use_columns = Setting(())
        gui.lineEdit(
            box2,
            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)

        # exclude_columns = Setting(())
        gui.lineEdit(
            box2,
            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)

        # return_result = Setting(['append', 'replace', 'new'])
        gui.comboBox(box2,
                     self,
                     "return_result",
                     label='Output results.',
                     items=['new', 'append', 'replace'],
                     sendSelectedValue=True,
                     callback=self.settings_changed)

        # add_index_columns = Setting(False)
        gui.checkBox(box2,
                     self,
                     "add_index_columns",
                     label='Keep index in the outputs.',
                     callback=self.settings_changed)

        # error_on_no_input = Setting(True)
        gui.checkBox(box2,
                     self,
                     "error_on_no_input",
                     label='Error on no input.',
                     callback=self.settings_changed)

        # return_semantic_type = Setting(['https://metadata.datadrivendiscovery.org/types/Attribute',
        #                                 'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'])
        gui.comboBox(
            box2,
            self,
            "return_semantic_type",
            label='Semantic type attach with results.',
            items=[
                'https://metadata.datadrivendiscovery.org/types/Attribute',
                'https://metadata.datadrivendiscovery.org/types/ConstructedAttribute'
            ],
            sendSelectedValue=True,
            callback=self.settings_changed)
        # Only for test
        #gui.button(box2, self, "Print Hyperparameters", callback=self._print_hyperparameter)

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