def __init__(self):
        super().__init__()

        self.dataset = None
        self.sample = None
        self.otherdata = None

        # GUI
        box = gui.widgetBox(self.controlArea, "Info")
        self.infoa = gui.widgetLabel(
            box, 'No data on input yet, waiting to get something.')
        self.infob = gui.widgetLabel(box, '')

        gui.separator(self.controlArea)
        self.optionsBox = gui.widgetBox(self.controlArea, "Options")
        gui.spin(self.optionsBox,
                 self,
                 'proportion',
                 minv=10,
                 maxv=90,
                 step=10,
                 label='Sample Size [%]:',
                 callback=[self.selection, self.checkCommit])
        gui.checkBox(self.optionsBox, self, 'commitOnChange',
                     'Commit data on selection change')
        gui.button(self.optionsBox, self, "Commit", callback=self.commit)
        self.optionsBox.setDisabled(True)

        self.resize(100, 50)
Exemple #2
0
    def __init__(self):
        super().__init__()

        # sets self.curvePoints, self.steps equidistant points from
        # 1/self.steps to 1
        self.updateCurvePoints()

# [start-snippet-2]
        self.scoring = [
            ("Classification Accuracy", Orange.evaluation.scoring.CA),
            ("AUC", Orange.evaluation.scoring.AUC),
            ("Precision", Orange.evaluation.scoring.Precision),
            ("Recall", Orange.evaluation.scoring.Recall)
        ]
# [end-snippet-2]
        #: input data on which to construct the learning curve
        self.data = None
        #: A {input_id: Learner} mapping of current learners from input channel
        self.learners = OrderedDict()
        #: A {input_id: List[Results]} mapping of input id to evaluation
        #: results list, one for each curve point
        self.results = OrderedDict()
        #: A {input_id: List[float]} mapping of input id to learning curve
        #: point scores
        self.curves = OrderedDict()

        # GUI
        box = gui.widgetBox(self.controlArea, "Info")
        self.infoa = gui.widgetLabel(box, 'No data on input.')
        self.infob = gui.widgetLabel(box, 'No learners.')

        gui.separator(self.controlArea)

        box = gui.widgetBox(self.controlArea, "Evaluation Scores")
        gui.comboBox(box, self, "scoringF",
                     items=[x[0] for x in self.scoring],
                     callback=self._invalidate_curves)

        gui.separator(self.controlArea)

        box = gui.widgetBox(self.controlArea, "Options")
        gui.spin(box, self, 'folds', 2, 100, step=1,
                 label='Cross validation folds:  ', keyboardTracking=False,
                 callback=lambda:
                 self._invalidate_results() if self.commitOnChange else None)
        gui.spin(box, self, 'steps', 2, 100, step=1,
                 label='Learning curve points:  ', keyboardTracking=False,
                 callback=[self.updateCurvePoints,
                           lambda: self._invalidate_results() if self.commitOnChange else None])
        gui.checkBox(box, self, 'commitOnChange', 'Apply setting on any change')
        self.commitBtn = gui.button(box, self, "Apply Setting",
                                    callback=self._invalidate_results,
                                    disabled=True)

        gui.rubber(self.controlArea)

        # table widget
        self.table = gui.table(self.mainArea,
                               selectionMode=QTableWidget.NoSelection)
    def __init__(self):
        super().__init__()
        self.network = None
        self.embedder = None
        self._worker_thread = None
        self._progress_updater = None

        def commit():
            return self.commit()

        box = gui.widgetBox(self.controlArea, box=True)
        kwargs = dict(controlWidth=75, alignment=Qt.AlignRight, callback=commit)
        gui.spin(box, self, "p", 0.0, 10.0, 0.1, label="Return parameter (p): ",
                 spinType=float, **kwargs)
        gui.spin(box, self, "q", 0.0, 10.0, 0.1, label="In-out parameter (q): ",
                 spinType=float, **kwargs)
        gui.spin(box, self, "walk_len", 1, 100_000, 1, label="Walk length: ",
                 **kwargs)
        gui.spin(box, self, "num_walks", 1, 10_000, 1, label="Walks per node: ",
                 **kwargs)
        gui.spin(box, self, "emb_size", 1, 10_000, 1, label="Embedding size: ",
                 **kwargs)
        gui.spin(box, self, "window_size", 1, 20, 1, label="Context size: ",
                 **kwargs)
        gui.spin(box, self, "num_epochs", 1, 100, 1, label="Number of epochs: ",
                 **kwargs)

        gui.auto_commit(self.controlArea, self, "auto_commit", "Commit",
                        checkbox_label="Auto-commit", orientation=Qt.Horizontal)
        commit()
Exemple #4
0
    def _setup_control_area(self) -> None:
        box = gui.widgetBox(self.controlArea, "Word Scoring Methods")
        for value, (n, _, tt) in SCORING_METHODS.items():
            b = gui.hBox(box, margin=0)
            gui.checkBox(
                b,
                self,
                value,
                label=n,
                callback=self.__setting_changed,
                tooltip=tt,
            )
            if value in ADDITIONAL_OPTIONS:
                value, options = ADDITIONAL_OPTIONS[value]
                gui.comboBox(
                    b,
                    self,
                    value,
                    items=options,
                    callback=self.__setting_changed,
                )

        box = gui.widgetBox(self.controlArea, "Aggregation")
        gui.comboBox(
            box,
            self,
            "aggregation",
            items=[n for n in AGGREGATIONS],
            callback=self.__setting_changed,
        )

        gui.rubber(self.controlArea)

        # select words box
        box = gui.vBox(self.buttonsArea, "Select Documents")
        grid = QGridLayout()
        grid.setContentsMargins(0, 0, 0, 0)

        self._sel_method_buttons = QButtonGroup()
        for method, label in enumerate(SelectionMethods.ITEMS):
            button = QRadioButton(label)
            button.setChecked(method == self.sel_method)
            grid.addWidget(button, method, 0)
            self._sel_method_buttons.addButton(button, method)
        self._sel_method_buttons.buttonClicked[int].connect(
            self.__set_selection_method)

        spin = gui.spin(
            box,
            self,
            "n_selected",
            1,
            999,
            addToLayout=False,
            callback=lambda: self.__set_selection_method(SelectionMethods.
                                                         N_BEST),
        )
        grid.addWidget(spin, 3, 1)
        box.layout().addLayout(grid)

        # autocommit
        gui.auto_send(self.buttonsArea, self, "auto_commit")
    def __init__(self):
        super().__init__()

        # sets self.curvePoints, self.steps equidistant points from
        # 1/self.steps to 1
        self.updateCurvePoints()

        self.scoring = [("Classification Accuracy",
                         Orange.evaluation.scoring.CA),
                        ("AUC", Orange.evaluation.scoring.AUC),
                        ("Precision", Orange.evaluation.scoring.Precision),
                        ("Recall", Orange.evaluation.scoring.Recall)]
        #: Input data on which to construct the learning curve
        self.data = None
        #: Optional test data
        self.testdata = None
        #: LearnerData for each learner input
        self.learners: List[LearnerData] = []

        # [start-snippet-3]
        #: The current evaluating task (if any)
        self._task = None  # type: Optional[Task]
        #: An executor we use to submit learner evaluations into a thread pool
        self._executor = concurrent.futures.ThreadPoolExecutor()
        # [end-snippet-3]

        # GUI
        box = gui.widgetBox(self.controlArea, "Info")
        self.infoa = gui.widgetLabel(box, 'No data on input.')
        self.infob = gui.widgetLabel(box, 'No learners.')

        gui.separator(self.controlArea)

        box = gui.widgetBox(self.controlArea, "Evaluation Scores")
        gui.comboBox(box,
                     self,
                     "scoringF",
                     items=[x[0] for x in self.scoring],
                     callback=self._invalidate_curves)

        gui.separator(self.controlArea)

        box = gui.widgetBox(self.controlArea, "Options")
        gui.spin(box,
                 self,
                 'folds',
                 2,
                 100,
                 step=1,
                 label='Cross validation folds:  ',
                 keyboardTracking=False,
                 callback=lambda: self._invalidate_results()
                 if self.commitOnChange else None)
        gui.spin(box,
                 self,
                 'steps',
                 2,
                 100,
                 step=1,
                 label='Learning curve points:  ',
                 keyboardTracking=False,
                 callback=[
                     self.updateCurvePoints,
                     lambda: self._invalidate_results()
                     if self.commitOnChange else None
                 ])
        gui.checkBox(box, self, 'commitOnChange',
                     'Apply setting on any change')
        self.commitBtn = gui.button(box,
                                    self,
                                    "Apply Setting",
                                    callback=self._invalidate_results,
                                    disabled=True)

        gui.rubber(self.controlArea)

        # table widget
        self.table = gui.table(self.mainArea,
                               selectionMode=QTableWidget.NoSelection)
    def __init__(self, parent=None, signalManager=None):
        widget.OWWidget.__init__(self, parent, signalManager)


        # GUI
        possible_geometries = GeometryType.allGeometryTypes()

        geometries = [geo.description() for geo in possible_geometries]
        self.geometries_mapping = {}
        for index,geo in enumerate(possible_geometries):
            self.geometries_mapping[index] = geo
            
        self.cbb_geometry_type = gui.comboBox(self,
                                              self,
                                              "value_cbb_geometry_type",
                                              box=None,
                                              label="Geometry type",
                                              items=geometries,
                                              control2attributeDict=self.geometries_mapping)
        
        crystal_names = ["Si",
                         "Diamond"]


        self.cbb_crystal_name = gui.comboBox(self,
                                             self,
                                             "value_cbb_crystal_name",
                                             box=None,
                                             label = "Crystal Name",
                                             items = crystal_names,
                                             control2attributeDict=self.crystal_names_mapping)
        
        
        self.le_thickness = gui.lineEdit(self,
                                         self,
                                         "value_le_thickness",
                                         label="Thickness [cm]")
        
        self.sp_miller_h = gui.spin(self,
                                    self,
                                    "value_sp_miller_h",
                                    -100000,
                                    100000,
                                    step=1,
                                    label="Miller index h")

        self.sp_miller_k = gui.spin(self,
                                    self,
                                    "value_sp_miller_k",
                                    -100000,
                                    100000,
                                    step=1,
                                    label="Miller index k")

        self.sp_miller_l = gui.spin(self,
                                    self,
                                    "value_sp_miller_l",
                                    -100000,
                                    100000,
                                    step=1,
                                    label="Miller index l")
        
        self.sp_asymmetry_angle = gui.spin(self,
                                           self,
                                           "value_sp_asymmetry_angle",
                                           0,
                                           90,
                                           step=1,
                                           label="Asymmetry angle [deg]")

        self.le_energy_min = gui.lineEdit(self,
                                          self,
                                          "value_le_energy_min",
                                          label="Minimum energy [keV]")

        self.le_energy_max = gui.lineEdit(self,
                                          self,
                                          "value_le_energy_max",
                                          label="Maximum energy [keV]")

        self.le_energy_min = gui.lineEdit(self,
                                          self,
                                          "value_le_energy_points",
                                          label="Energy points")

        self.le_angle_min = gui.lineEdit(self,
                                         self,
                                         "value_le_angle_min",
                                         label="Angle min [micro rad]")

        self.le_angle_max = gui.lineEdit(self,
                                         self,
                                         "value_le_angle_max",
                                         label="Angle max [micro rad]")

        self.le_angle_points = gui.lineEdit(self,
                                            self,
                                            "value_le_angle_points",
                                            label="Angle points")
        
        self.btn_calculate = gui.button(self,
                                        self,
                                        "Calculate",
                                        self.calculate)