Ejemplo n.º 1
0
    def createShowHiddenLists(self, placementTab, callback = None):
        maxWidth = 180
        self.updateCallbackFunction = callback
        self.shownAttributes = []
        self.selectedShown = []
        self.hiddenAttributes = []
        self.selectedHidden = []

        self.shownAttribsGroup = OWGUI.widgetBox(placementTab, " Shown attributes " )
        self.addRemoveGroup = OWGUI.widgetBox(placementTab, 1, orientation = "horizontal" )
        self.hiddenAttribsGroup = OWGUI.widgetBox(placementTab, " Hidden attributes ")

        hbox = OWGUI.widgetBox(self.shownAttribsGroup, orientation = 'horizontal')
        self.shownAttribsLB = OWGUI.listBox(hbox, self, "selectedShown", "shownAttributes", callback = self.resetAttrManipulation, dragDropCallback = callback, enableDragDrop = 1, selectionMode = QListWidget.ExtendedSelection)
        #self.shownAttribsLB.setMaximumWidth(maxWidth)
        vbox = OWGUI.widgetBox(hbox, orientation = 'vertical')
        self.buttonUPAttr   = OWGUI.button(vbox, self, "", callback = self.moveAttrUP, tooltip="Move selected attributes up")
        self.buttonDOWNAttr = OWGUI.button(vbox, self, "", callback = self.moveAttrDOWN, tooltip="Move selected attributes down")
        self.buttonUPAttr.setIcon(QIcon(os.path.join(self.widgetDir, "icons/Dlg_up3.png")))
        self.buttonUPAttr.setSizePolicy(QSizePolicy(QSizePolicy.Fixed , QSizePolicy.Expanding))
        self.buttonUPAttr.setMaximumWidth(30)
        self.buttonDOWNAttr.setIcon(QIcon(os.path.join(self.widgetDir, "icons/Dlg_down3.png")))
        self.buttonDOWNAttr.setSizePolicy(QSizePolicy(QSizePolicy.Fixed , QSizePolicy.Expanding))
        self.buttonDOWNAttr.setMaximumWidth(30)

        self.attrAddButton =    OWGUI.button(self.addRemoveGroup, self, "", callback = self.addAttribute, tooltip="Add (show) selected attributes")
        self.attrAddButton.setIcon(QIcon(os.path.join(self.widgetDir, "icons/Dlg_up3.png")))
        self.attrRemoveButton = OWGUI.button(self.addRemoveGroup, self, "", callback = self.removeAttribute, tooltip="Remove (hide) selected attributes")
        self.attrRemoveButton.setIcon(QIcon(os.path.join(self.widgetDir, "icons/Dlg_down3.png")))
        self.showAllCB = OWGUI.checkBox(self.addRemoveGroup, self, "showAllAttributes", "Show all", callback = self.cbShowAllAttributes)

        self.hiddenAttribsLB = OWGUI.listBox(self.hiddenAttribsGroup, self, "selectedHidden", "hiddenAttributes", callback = self.resetAttrManipulation, dragDropCallback = callback, enableDragDrop = 1, selectionMode = QListWidget.ExtendedSelection)
Ejemplo n.º 2
0
    def __init__(self,
                 parent,
                 caption="Color Palette",
                 callback=None,
                 modal=True):
        OWBaseWidget.__init__(self, None, None, caption, modal=modal)
        self.setLayout(QVBoxLayout(self))
        self.layout().setMargin(4)

        self.callback = callback
        self.contPaletteNames = []
        self.exContPaletteNames = []
        self.discPaletteNames = []
        self.colorButtonNames = []
        self.colorSchemas = []
        self.selectedSchemaIndex = 0

        self.mainArea = OWGUI.widgetBox(self, spacing=4)
        self.layout().addWidget(self.mainArea)
        self.schemaCombo = OWGUI.comboBox(self.mainArea,
                                          self,
                                          "selectedSchemaIndex",
                                          box="Saved Profiles",
                                          callback=self.paletteSelected)

        self.hbox = OWGUI.widgetBox(self, orientation="horizontal")
        self.okButton = OWGUI.button(self.hbox, self, "OK", self.acceptChanges)
        self.cancelButton = OWGUI.button(self.hbox, self, "Cancel",
                                         self.reject)
        self.setMinimumWidth(230)
        self.resize(350, 200)
Ejemplo n.º 3
0
    def __init__(self,
                 parent=None,
                 signalManager=None,
                 name="Save Association Rules"):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          name,
                          wantMainArea=False)

        self.inputs = [("Association Rules", associate.AssociationRules,
                        self.set_rules)]

        self.last_save_file = os.path.expanduser("~/orange_assoc_rules.pck")
        self.filename_history = []
        self.selected_file_index = 0

        self.loadSettings()

        #####
        # GUI
        #####
        box = OWGUI.widgetBox(self.controlArea,
                              "File",
                              orientation="horizontal",
                              addSpace=True)

        self.files_combo = OWGUI.comboBox(
            box,
            self,
            "selected_file_index",
            items=[os.path.basename(f) for f in self.filename_history],
            tooltip="Select a recently saved file",
            callback=self.on_recent_selection)

        self.browse_button = OWGUI.button(box,
                                          self,
                                          "...",
                                          tooltip="Browse local file system",
                                          callback=self.browse)

        self.browse_button.setIcon(self.style().standardIcon(
            QStyle.SP_DirOpenIcon))
        self.browse_button.setSizePolicy(QSizePolicy.Maximum,
                                         QSizePolicy.Fixed)

        box = OWGUI.widgetBox(self.controlArea, "Save")
        self.save_button = OWGUI.button(box,
                                        self,
                                        "Save current rules",
                                        callback=self.save_rules,
                                        autoDefault=True)

        self.save_button.setEnabled(False)

        OWGUI.rubber(self.controlArea)

        self.resize(200, 100)

        self.rules = None
Ejemplo n.º 4
0
    def defineGUI(self):
        # methods Selection
        self.methodsListBox = OWGUI.listBox(
            self.controlArea,
            self,
            "selectedMethods",
            "methodsList",
            box="Select Chemical Similarity Methods",
            selectionMode=QListWidget.ExtendedSelection,
        )
        # Set location of model file
        boxFile = OWGUI.widgetBox(self.controlArea, "Path for loading Actives", addSpace=True, orientation=0)
        L1 = OWGUI.lineEdit(
            boxFile,
            self,
            "activesFile",
            labelWidth=80,
            orientation="horizontal",
            tooltip="Actives must be specified in a .smi file",
        )
        L1.setMinimumWidth(200)
        button = OWGUI.button(
            boxFile, self, "...", callback=self.browseFile, disabled=0, tooltip="Browse for a file to load the Actives"
        )
        button.setMaximumWidth(25)

        # Load Actives
        OWGUI.button(boxFile, self, "Load Actives", callback=self.loadActives)

        # Start descriptors calculation
        OWGUI.button(self.controlArea, self, "Calculate descriptors", callback=self.calcDesc)

        self.adjustSize()
Ejemplo n.º 5
0
    def createDiscretePalette(self,
                              paletteName,
                              boxCaption,
                              rgbColors=defaultRGBColors):
        vbox = OWGUI.widgetBox(self.mainArea,
                               boxCaption,
                               orientation='vertical')
        self.__dict__["disc" + paletteName + "View"] = PaletteView(vbox)
        self.__dict__["disc" + paletteName + "View"].rgbColors = rgbColors

        hbox = OWGUI.widgetBox(vbox, orientation='horizontal')
        self.__dict__["disc" + paletteName + "EditButt"] = OWGUI.button(
            hbox,
            self,
            "Edit palette",
            self.editPalette,
            tooltip="Edit the order and colors of the palette",
            debuggingEnabled=0,
            toggleButton=1)
        self.__dict__["disc" + paletteName + "LoadButt"] = OWGUI.button(
            hbox,
            self,
            "Load palette",
            self.loadPalette,
            tooltip="Load a predefined color palette",
            debuggingEnabled=0,
            toggleButton=1)
        self.discPaletteNames.append(paletteName)
Ejemplo n.º 6
0
 def __init__(self, parent=None, signalManager=None, title="Gaussin Mixture"):
     OWWidget.__init__(self, parent, signalManager, title)
     
     self.inputs = [("Data", Orange.data.Table, self.set_data)]
     self.outputs = [("Data with Indicator Matrix", Orange.data.Table)]
     
     self.init_method = 0
     self.n = 3
     self.auto_commit = True
     
     self.loadSettings()
     
     #####
     # GUI
     #####
     
     OWGUI.spin(self.controlArea, self, "n", min=1, max=10, step=1,
                box="Settings",
                label="Number of gaussians", 
                tooltip="The number of gaussians in the mixture ",
                callback=self.on_params_changed)
     
     OWGUI.comboBox(self.controlArea, self, "init_method",
                    box="Initialization",
                    items=["K-means", "Random"],
                    tooltip="Method used to initialize the mixture", callback=self.on_params_changed)
     
     OWGUI.button(self.controlArea, self, "Apply", callback=self.commit)
Ejemplo n.º 7
0
    def __init__(self, parent=None, signalManager=None, name='kmeans'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0)

        self.callbackDeposit = []

        self.inputs = [("Codebook", Codebook, self.setCodebook),
                       ("Data", Descriptors, self.setData)]
        self.outputs = [("Clusters", Clusters)]

        self.useLazyEvaluation = pynopticon.useLazyEvaluation

        # Settings
        self.name = name
        self.loadSettings()

        wbN = OWGUI.widgetBox(self.controlArea, "Quantization settings")

        OWGUI.checkBox(wbN, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.button(self.controlArea,
                     self,
                     "&Apply Settings",
                     callback=self.applySettings,
                     disabled=0)

        self.resize(100, 150)

        self.quantize = pynopticon.cluster.Quantize(
            useLazyEvaluation=self.useLazyEvaluation)
Ejemplo n.º 8
0
    def __init__(self, parent=None, signalManager=None, name='Distance File'):
        self.callbackDeposit = []  # deposit for OWGUI callback functions
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          name,
                          wantMainArea=0,
                          resizingEnabled=0)
        self.inputs = [("Distance Matrix", orange.SymMatrix, self.setData)]

        self.recentFiles = []
        self.fileIndex = 0
        self.takeAttributeNames = False
        self.data = None
        self.loadSettings()

        box = OWGUI.widgetBox(self.controlArea, "Distance File")
        hbox = OWGUI.widgetBox(box, orientation="horizontal")
        self.filecombo = OWGUI.comboBox(hbox, self, "fileIndex")
        self.filecombo.setMinimumWidth(250)
        button = OWGUI.button(hbox, self, '...', callback=self.browseFile)

        fbox = OWGUI.widgetBox(self.controlArea, "Save")
        self.save = OWGUI.button(fbox,
                                 self,
                                 "Save current data",
                                 callback=self.saveFile)
        self.save.setDisabled(1)

        self.setFilelist()
        self.filecombo.setCurrentIndex(0)

        button.setMaximumWidth(25)
        self.adjustSize()
Ejemplo n.º 9
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'AttributeSampler')

        self.inputs = [("Examples", Orange.data.Table, self.dataset)]
        self.outputs = [("Examples", Orange.data.Table)]

        self.icons = self.createAttributeIconDict()

        self.attributeList = []
        self.selectedAttributes = []
        self.classAttribute = None
        self.loadSettings()

        OWGUI.listBox(self.controlArea, self, "selectedAttributes",
                      "attributeList",
                      box="Selected attributes",
                      selectionMode=QListWidget.ExtendedSelection)

        OWGUI.separator(self.controlArea)
        self.classAttrCombo = OWGUI.comboBox(
            self.controlArea, self, "classAttribute",
            box="Class attribute")

        OWGUI.separator(self.controlArea)
        OWGUI.button(self.controlArea, self, "Commit",
                     callback=self.outputData)

        self.resize(150,400)
Ejemplo n.º 10
0
    def __init__(self, parent=None, signalManager = None, name='Histogram'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

        self.inputs = [("Data", Clusters, self.setData)]
        self.outputs = [("Histogram", Histograms)] # , ("Histograms", ExampleTable)]

        self.useLazyEvaluation = pynopticon.useLazyEvaluation
        
        # Settings
        self.name = name
	self.histogram = None
	self.bins = 200
        self.loadSettings()        

        self.data = None                    # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Histogram Settings")
        OWGUI.spin(wbN, self, "bins", 1, 100000, 100, None, "Number of bins  ", orientation="horizontal")

        OWGUI.separator(self.controlArea)
	wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.button(self.controlArea, self, "&Apply Settings", callback = self.applySettings, disabled=0)

        self.resize(100,150)
Ejemplo n.º 11
0
    def __init__(self, parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, 'Majority', wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

        self.inputs = [("Examples", ExampleTable, self.setData), ("Preprocess", PreprocessedLearner, self.setPreprocessor)]
        self.outputs = [("Learner", orange.Learner),("Classifier", orange.Classifier)]

        self.name = 'Majority'
        
        self.data = None
        self.preprocessor = None

        OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name', \
                 tooltip='Name to be used by other widgets to identify your learner/classifier.')

        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea, self, "&Apply", callback = self.setLearner, disabled=0)
        
        OWGUI.rubber(self.controlArea)

        self.learner = orange.MajorityLearner()
        self.setLearner()
        self.resize(100,100)
Ejemplo n.º 12
0
    def __init__(self, canvasDlg, *args):
        #apply(QDialog.__init__,(self,) + args)
        QDialog.__init__(self,canvasDlg)
        self.canvasDlg = canvasDlg

        self.signals = []
        self._links = []
        self.allSignalsTaken = 0

        # GUI    ### canvas dialog that is shown when there are multiple possible connections.
        self.setWindowTitle(_('Connect Signals'))
        self.setLayout(QVBoxLayout())

        self.canvasGroup = OWGUI.widgetBox(self, 1)
        self.canvas = QGraphicsScene(0,0,1000,1000)
        self.canvasView = SignalCanvasView(self, self.canvasDlg, self.canvas, self.canvasGroup)
        self.canvasGroup.layout().addWidget(self.canvasView)

        buttons = OWGUI.widgetBox(self, orientation = "horizontal", sizePolicy = QSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed))

        self.buttonHelp = OWGUI.button(buttons, self, "&Help")
        buttons.layout().addStretch(1)
        self.buttonClearAll = OWGUI.button(buttons, self, "Clear &All", callback = self.clearAll)
        self.buttonOk = OWGUI.button(buttons, self, "&OK", callback = self.accept)
        self.buttonOk.setAutoDefault(1)
        self.buttonOk.setDefault(1)
        self.buttonCancel = OWGUI.button(buttons, self, "&Cancel", callback = self.reject)
Ejemplo n.º 13
0
    def __init__(self, parent=None, signalManager=None, name="filter"):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0)

        self.callbackDeposit = []

        self.inputs = [("Images PIL", SeqContainer, self.setData)]
        self.outputs = [("Filtered Images PIL", SeqContainer)]

        self.useLazyEvaluation = armor.useLazyEvaluation

        # Settings
        self.name = name
        self.filter = None
        self.filterID = 5
        self.filters = armor.filter.Filter().filters.keys()
        self.loadSettings()

        self.data = None  # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Filter Settings")
        self.filecombo = OWGUI.comboBoxWithCaption(
            wbN, self, "filterID", "Filters: ", items=self.filters, valueType=str
        )

        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea, self, "&Apply Settings", callback=self.applySettings, disabled=0)

        self.resize(100, 150)
 def __init__(self, parent=None, signalManager=None, name="Ensemble"):
     OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False)
     
     self.inputs = [("Learner", orange.Learner, self.setLearner), ("Data", ExampleTable, self.setData)]
     self.outputs = [("Learner", orange.Learner), ("Classifier", orange.Classifier)]
     
     self.method = 0
     self.t = 10
     
     self.loadSettings()
     
     box = OWGUI.radioButtonsInBox(self.controlArea, self, "method",
                                   [name for name, _ in self.METHODS], 
                                   box="Ensemble",
                                   callback=self.onChange)
     
     i_box = OWGUI.indentedBox(box, sep=OWGUI.checkButtonOffsetHint(box.buttons[0]))
     
     OWGUI.spin(i_box, self, "t", min=1, max=100, step=1, label="Number of created classifiers:")
     OWGUI.rubber(self.controlArea)
     OWGUI.button(self.controlArea, self, "&Apply", callback=self.commit)
     
     self.data = None
     self.learner = None
     
     self.resize(100, 100)
Ejemplo n.º 15
0
    def __init__(self, parent=None, signalManager = None, name='Loader'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

        self.inputs = []
	self.outputs = [("Descriptors", Descriptors),
		       ("Codebook", Codebook),
		       ("Images", Images),
		       ("Labels", Labels),
		       ("Histograms", Histograms),
		       ("Clusters", Clusters)]

        self.useLazyEvaluation = pynopticon.useLazyEvaluation
        
        # Settings
        self.name = name
        self.loadSettings()

	self.fname = None
        self.slot = None
	
        #OWGUI.separator(self.controlArea)
        
        OWGUI.button(self.controlArea, self, "Loading from...", callback = self.browseFile, disabled=0)

        self.resize(50,150)
Ejemplo n.º 16
0
    def __init__(self, parent=None, signalManager = None, name='filter'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

        self.inputs = [("Untransformed Data", SeqContainer, self.setData), ("Labels", SeqContainer, self.setLabels)]
        self.outputs = [("Transformed Data", SeqContainer)]

        self.useLazyEvaluation = armor.useLazyEvaluation
        
        # Settings
        self.name = name
        self.transform = None
        self.transidx = 1
        self.transtype = None
        self.transtypes = ['none', 'PCA','KPCA', 'LLE']
        self.kernel = None
        self.kernelidx = 1
        self.kerneltypes = ['linear_kernel', 'gaussian_kernel', 'chi2_kernel']
        self.loadSettings()

        self.data = None                    # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Transformation Settings")
        self.transcombo = OWGUI.comboBoxWithCaption(wbN, self, "transidx", "Transform type: ", items=self.transtypes, valueType = int)
        self.kernelcombo = OWGUI.comboBoxWithCaption(wbN, self, "kernelidx", "Kernel type: ", items=self.kerneltypes, valueType = int)
        
        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)
        
        OWGUI.button(self.controlArea, self, "&Apply Settings", callback = self.applySettings, disabled=0)

        self.resize(100,150)
Ejemplo n.º 17
0
    def __init__(self, parent=None, signalManager = None, name='kmeans'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

        self.inputs = [("Data", Descriptors, self.setData)]
        self.outputs = [("Codebook", Codebook)] # , ("Histograms", ExampleTable)]

        self.useLazyEvaluation = pynopticon.useLazyEvaluation
        
        # Settings
        self.name = name
        self.kmeans = None
        self.loadSettings()

        self.numClusters = 20
        self.maxiter = 0
        self.numruns = 1
        self.sampleFromData = 1.0

        self.loadSettings()
        
        wbN = OWGUI.widgetBox(self.controlArea, "kMeans Settings")
        OWGUI.spin(wbN, self, "numClusters", 1, 100000, 100, None, "Number of clusters   ", orientation="horizontal")
        OWGUI.spin(wbN, self, "maxiter", 0, 100000, 1, None, "Maximum number of iterations", orientation="horizontal")
        OWGUI.spin(wbN, self, "numruns", 0, 100000, 1, None, "Number of runs ", orientation="horizontal")
        OWGUI.widgetLabel(wbN, 'Use x% of the data')
        OWGUI.lineEdit(wbN, self, 'sampleFromData', valueType=float)
        OWGUI.separator(self.controlArea)
	wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.button(self.controlArea, self, "&Apply Settings", callback = self.applySettings, disabled=0)

        self.resize(100,150)
Ejemplo n.º 18
0
    def __init__(self, parent=None, signalManager = None, name='C4.5'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

        self.inputs = [("Data", ExampleTable, self.setData),
                       ("Preprocess", PreprocessedLearner, self.setPreprocessor)]
        
        self.outputs = [("Learner", orange.Learner),
                        ("Classification Tree", Orange.classification.tree.TreeClassifier)]#, ("C45 Tree", orange.C45Classifier)]

        # Settings
        self.name = 'C4.5'
        self.infoGain = 0;  self.subset = 0;       self.probThresh = 0;
        self.useMinObjs = 1; self.minObjs = 2;   self.prune = 1;       self.cf = 25
        self.iterative = 0; self.manualWindow = 0; self.window = 50;     self.manualIncrement = 0;  self.increment = 10;   self.trials = 10

        self.convertToOrange = 1

        self.loadSettings()

        self.data = None                    # input data set
        self.preprocessor = None            # no preprocessing as default

        OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name',
                 tooltip='Name to be used by other widgets to identify your learner/classifier.')
        OWGUI.separator(self.controlArea)

        self.wbSplit = OWGUI.widgetBox(self.controlArea, "Splitting")
        OWGUI.checkBox(self.wbSplit, self, 'infoGain', 'Use information gain instead of ratio (-g)')
        OWGUI.checkBox(self.wbSplit, self, 'subset', 'Subsetting (-s)')
        OWGUI.checkBox(self.wbSplit, self, 'probThresh', 'Probabilistic threshold for continuous attributes (-p)')

        OWGUI.separator(self.controlArea)

        self.wbPruning = OWGUI.widgetBox(self.controlArea, "Pruning")
        OWGUI.checkWithSpin(self.wbPruning, self, 'Minimal examples in leaves (-m)', 1, 1000, 'useMinObjs', 'minObjs', '', 1, labelWidth = 225)
        OWGUI.checkWithSpin(self.wbPruning, self, 'Post pruning with confidence level (-cf) of ', 0, 100, 'prune', 'cf', '', 5, labelWidth = 225)

        OWGUI.separator(self.controlArea)

        self.wbIterative = OWGUI.widgetBox(self.controlArea, "Iterative generation")
        self.cbIterative = OWGUI.checkBox(self.wbIterative, self, 'iterative', 'Generate the tree iteratively (-i, -t, -w)')
        self.spTrial = OWGUI.spin(self.wbIterative, self, 'trials', 1, 30, 1, '', "       Number of trials (-t)", orientation = "horizontal", labelWidth = 225)
        self.csWindow = OWGUI.checkWithSpin(self.wbIterative, self, "Manually set initial window size (-w) to ", 10, 1000, 'manualWindow', 'window', '', 10, labelWidth = 225)
        self.csIncrement = OWGUI.checkWithSpin(self.wbIterative, self, "Manually set window increment (-i) to ", 10, 1000, 'manualIncrement', 'increment', '', 10, labelWidth = 225)

        self.cbIterative.disables = [self.spTrial, self.csWindow, self.csIncrement]
        self.cbIterative.makeConsistent()

#        OWGUI.separator(self.controlArea)

#        OWGUI.checkBox(self.controlArea, self, 'convertToOrange', 'Convert to orange tree structure', box = 1)

        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea, self, "&Apply", callback = self.setLearner, disabled=0, default=True)

        OWGUI.rubber(self.controlArea)
        self.setLearner()
Ejemplo n.º 19
0
    def __init__(self, parent=None, signalManager=None, name = "WordNgram"):
        OWWidget.__init__(self,parent,signalManager,name)
        self.inputs = [("Example Table", ExampleTable, self.dataset)]
        self.outputs = [("Example Table", ExampleTable)]

        self.recentFiles=[]
        self.fileIndex = 0
        self.loadSettings()
        self.stopwords = None
        self.size = 0
        self.measure = 0
        self.threshold = 0
        self.data = None
        self.measureDict = {0: 'FREQ', 1: 'MI', 2: 'DICE', 3: 'CHI', 4: 'LL'}

        #GUI        
        optionBox = OWGUI.widgetBox(self.controlArea, "", "horizontal") #QHGroupBox('', self.controlArea)
        OWGUI.radioButtonsInBox(optionBox, self, "size", box = "No. of words", btnLabels = ["2", "3", "4", "Named entities"], addSpace = True, callback = self.radioChanged)
        self.ambox = OWGUI.radioButtonsInBox(optionBox, self, "measure", box = "Association measure", btnLabels = ["Frequency", "Mutual information", "Dice coefficient", "Chi square", "Log likelihood"], addSpace = True)
        self.ambox.setEnabled(self.size - 3)
        box = OWGUI.widgetBox(optionBox, "") #QVGroupBox('', optionBox)
        OWGUI.lineEdit(box, self, "threshold", orientation="horizontal", valueType=float, box="Threshold")

        stopbox = OWGUI.widgetBox(box, "Stopwords File")
        stophbox = OWGUI.widgetBox(stopbox, orientation="horizontal") #1)
        self.filecombo = OWGUI.comboBox(stophbox, self, "fileIndex", callback = self.loadFile)
        OWGUI.button(stophbox, self, '...', callback = self.browseFile)
        OWGUI.button(self.controlArea, self, "Apply", self.apply)
        self.lblFeatureNo = OWGUI.widgetLabel(self.controlArea, "\nNo. of features: ") #QLabel("\nNo. of features: ", self.controlArea)
        OWGUI.rubber(self.controlArea)
        self.adjustSize()

        if self.recentFiles:
            self.loadFile()
Ejemplo n.º 20
0
    def __init__(self, parent=None, signalManager = None, name='Label Powerset'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

        self.inputs = [("Examples", ExampleTable, self.set_data), 
                       ("Preprocess", PreprocessedLearner, self.set_preprocessor),
                       ("Binary Classification", Orange.classification.Learner, self.set_base_learner)
                       ]
        self.outputs = [("Learner", orange.Learner),("LabelPowerset Classifier", Orange.multilabel.LabelPowersetClassifier)]

        # Settings
        self.name = 'Label Powerset'
        self.base_learner = Orange.core.BayesLearner;
        
        self.loadSettings()

        self.data = None                    # input data set
        self.preprocessor = None            # no preprocessing as default
        self.set_learner()                   # this just sets the learner, no data
                                            # has come to the input yet

        OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name', \
                 tooltip='Name to be used by other widgets to identify your learner/classifier.')

        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea, self, "&Apply", callback=self.set_learner, disabled=0, default=True)
        
        OWGUI.rubber(self.controlArea)

        self.resize(100,250)
Ejemplo n.º 21
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'SampleDataC')
        
        self.inputs = [("Data", Orange.data.Table, self.set_data)]
# [start-snippet-1]
        self.outputs = [("Sampled Data", Orange.data.Table),
                        ("Other Data", Orange.data.Table)]
# [end-snippet-1]
        self.proportion = 50
        self.commitOnChange = 0
        self.loadSettings()

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

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

        self.resize(100,50)
Ejemplo n.º 22
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Itemsets", wantMainArea = 0)

        from OWItemsets import Itemsets
        self.inputs = [("Data", ExampleTable, self.setData)]
        self.outputs = [("Itemsets", Itemsets)]

        self.minSupport = 60
        self.maxRules = 10000
        self.useSparseAlgorithm = False
        self.loadSettings()

        self.dataset = None

        box = OWGUI.widgetBox(self.space, "Settings", addSpace = True)
        OWGUI.checkBox(box, self, 'useSparseAlgorithm', 'Use algorithm for sparse data', tooltip="Use original Agrawal's algorithm")
        OWGUI.widgetLabel(box, "Minimal support [%]")
        OWGUI.hSlider(box, self, 'minSupport', minValue=1, maxValue=100, ticks=10, step = 1)
        OWGUI.separator(box, 0, 0)
        OWGUI.widgetLabel(box, 'Maximal number of rules')
        OWGUI.hSlider(box, self, 'maxRules', minValue=10000, maxValue=100000, step=10000, ticks=10000, debuggingEnabled = 0)

        OWGUI.button(self.space, self, "&Find Itemsets", self.findItemsets, default=True)

        OWGUI.rubber(self.controlArea)
        self.adjustSize()
Ejemplo n.º 23
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'AttributeSampler')

        self.inputs = [("Examples", ExampleTable, self.dataset)]
        self.outputs = [("Examples", ExampleTable)]

        self.icons = self.createAttributeIconDict()

        self.attributeList = []
        self.selectedAttributes = []
        self.classAttribute = None
        self.loadSettings()

        OWGUI.listBox(self.controlArea,
                      self,
                      "selectedAttributes",
                      "attributeList",
                      box="Selected attributes",
                      selectionMode=QListWidget.ExtendedSelection)
        OWGUI.separator(self.controlArea)
        self.classAttrCombo = OWGUI.comboBox(self.controlArea,
                                             self,
                                             "classAttribute",
                                             box="Class attribute")
        OWGUI.separator(self.controlArea)
        OWGUI.button(self.controlArea,
                     self,
                     "Commit",
                     callback=self.outputData)

        self.resize(150, 400)
Ejemplo n.º 24
0
    def __init__(self, parent=None, signalManager = None, name='ExtractFeatures'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

        self.inputs = [("Images PIL", SeqContainer, self.setData)]
        self.outputs = [("Descriptors", SeqContainer)]

        self.useLazyEvaluation = armor.useLazyEvaluation
        
        # Settings
        self.name = name
        self.feature = None
        self.featureID = 0
        self.featureType = None
        self.features = armor.features.Nowozin.features
        self.loadSettings()

        self.data = None                    # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Feature Extractor Settings")
        self.filecombo = OWGUI.comboBoxWithCaption(wbN, self, "featureID", "Feature type: ", items=self.features, valueType = int)

        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)
        
        OWGUI.button(self.controlArea, self, "&Apply Settings", callback = self.applySettings, disabled=0)

        self.resize(100,150)
Ejemplo n.º 25
0
    def __init__(self, parent=None, signalManager=None, title="Array Express"):
        OWWidget.__init__(self, parent, signalManager, title)

        self.outputs = [("Data Table", Orange.data.Table)]
        self.current_experiment = None
        self.search_string = ""

        self.loadSettings()

        #####
        # GUI
        #####

        box = OWGUI.widgetBox(self.controlArea, "Info")
        self.info = OWGUI.widgetLabel(box, "\n")

        OWGUI.rubber(self.controlArea)
        OWGUI.button(self.controlArea, self, "Commit", callback=self.commit)

        self.experiments_view = QTreeView(self)
        self.experiments_view.setSortingEnabled(True)
        self.experiments_view.viewport().setMouseTracking(True)
        self.experiments_view.setItemDelegateForColumn(
            0, OWGUI.LinkStyledItemDelegate(self.experiments_view)
        )

        model = QStandardItemModel()
        model.setHorizontalHeaderLabels(self.HEADER_LABELS)

        self.experiments_view.setModel(model)

        self.mainArea.layout().addWidget(self.experiments_view)

        self.setEnabled(False)
        QTimer.singleShot(5, self.fill_experiments)
Ejemplo n.º 26
0
    def __init__(self, parent=None, signalManager = None, name='filter'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

        self.inputs = [("Unnormalized Data", Histograms, self.setData)]
        self.outputs = [("Normalized Data", Histograms)]

        self.useLazyEvaluation = pynopticon.useLazyEvaluation
        
        # Settings
        self.name = name
	self.normalize = None
        self.normtype = 1
	self.normtypes = ['none', 'bin', 'L1', 'L2', 'whiten', 'bias', 'crop', 'log']
        self.loadSettings()

        self.data = None                    # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Normalization Settings")
        self.filecombo = OWGUI.comboBoxWithCaption(wbN, self, "normtype", "Normalize type: ", items=self.normtypes, valueType = int)

        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)
        
        OWGUI.button(self.controlArea, self, "&Apply Settings", callback = self.applySettings, disabled=0)

        self.resize(100,150)
Ejemplo n.º 27
0
    def __init__(self, parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, 'Majority', wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

        self.inputs = [("Data", ExampleTable, self.setData), ("Preprocess", PreprocessedLearner, self.setPreprocessor)]
        self.outputs = [("Learner", orange.Learner),("Classifier", orange.Classifier)]

        self.name = 'Majority'
        
        self.data = None
        self.preprocessor = None

        OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name', \
                 tooltip='Name to be used by other widgets to identify your learner/classifier.')

        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea, self, "&Apply", callback=self.setLearner, disabled=0, default=True)
        
        OWGUI.rubber(self.controlArea)

        self.learner = orange.MajorityLearner()
        self.setLearner()
        self.resize(100,100)
Ejemplo n.º 28
0
    def __init__(self, parent=None, signalManager = None, name='Distance File'):
        self.callbackDeposit = [] # deposit for OWGUI callback functions
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)
        self.inputs = [("Distances", orange.SymMatrix, self.setData)]

        self.recentFiles=[]
        self.fileIndex = 0
        self.takeAttributeNames = False
        self.data = None
        self.loadSettings()

        box = OWGUI.widgetBox(self.controlArea, "Distance File")
        hbox = OWGUI.widgetBox(box, orientation = "horizontal")
        self.filecombo = OWGUI.comboBox(hbox, self, "fileIndex")
        self.filecombo.setMinimumWidth(250)
        button = OWGUI.button(hbox, self, '...', callback = self.browseFile)
        button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        
        fbox = OWGUI.widgetBox(self.controlArea, "Save")
        self.save = OWGUI.button(fbox, self, "Save current data", callback = self.saveFile, default=True)
        self.save.setDisabled(1)
        
        self.setFilelist()
        self.filecombo.setCurrentIndex(0)
        
        OWGUI.rubber(self.controlArea)
        self.adjustSize()
Ejemplo n.º 29
0
    def __init__(self, parentWidget = None, attr = "", valueList = []):
        OWBaseWidget.__init__(self, None, None, "Sort Attribute Values", modal = TRUE)

        self.setLayout(QVBoxLayout())
        #self.space = QWidget(self)
        #self.layout = QVBoxLayout(self, 4)
        #self.layout.addWidget(self.space)

        box1 = OWGUI.widgetBox(self, "Select Value Order for Attribute \"" + attr + '"', orientation = "horizontal")

        self.attributeList = OWGUI.listBox(box1, self, selectionMode = QListWidget.ExtendedSelection, enableDragDrop = 1)
        self.attributeList.addItems(valueList)

        vbox = OWGUI.widgetBox(box1, "", orientation = "vertical")
        self.buttonUPAttr   = OWGUI.button(vbox, self, "", callback = self.moveAttrUP, tooltip="Move selected attribute values up")
        self.buttonDOWNAttr = OWGUI.button(vbox, self, "", callback = self.moveAttrDOWN, tooltip="Move selected attribute values down")
        self.buttonUPAttr.setIcon(QIcon(os.path.join(self.widgetDir, "icons/Dlg_up3.png")))
        self.buttonUPAttr.setSizePolicy(QSizePolicy(QSizePolicy.Fixed , QSizePolicy.Expanding))
        self.buttonUPAttr.setFixedWidth(40)
        self.buttonDOWNAttr.setIcon(QIcon(os.path.join(self.widgetDir, "icons/Dlg_down3.png")))
        self.buttonDOWNAttr.setSizePolicy(QSizePolicy(QSizePolicy.Fixed , QSizePolicy.Expanding))
        self.buttonDOWNAttr.setFixedWidth(40)

        box2 = OWGUI.widgetBox(self, 1, orientation = "horizontal")
        self.okButton =     OWGUI.button(box2, self, "OK", callback = self.accept)
        self.cancelButton = OWGUI.button(box2, self, "Cancel", callback = self.reject)

        self.resize(300, 300)
Ejemplo n.º 30
0
    def defineGUI(self):

        # Set the number of hidden neurons throught the GUI
        OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name', \
                       tooltip='Name to be used by other widgets to identify your learner/classifier.<br>This should be a unique name!')

        # Apply the settings and send the learner to the output channel
        OWGUI.button(self.controlArea, self,"&Apply settings", callback=self.applySettings)

        # Get desired location of model file
        boxFile = OWGUI.widgetBox(self.controlArea, "Path for saving Model", addSpace = True, orientation=0)
        L1 = OWGUI.lineEdit(boxFile, self, "modelFile", labelWidth=80,  orientation = "horizontal", \
        tooltip = "Once a model is created (connect this widget with a data widget), \nit can be saved by giving a \
file name here and clicking the save button.")
        L1.setMinimumWidth(200)
        button = OWGUI.button(boxFile, self, '...', callback = self.browseFile, disabled=0,tooltip = "Choose the dir where to save. After chosen, add a name for the model file!")
        button.setMaximumWidth(25)

        # Save the model
        OWGUI.button(self.controlArea, self,"&Save model to file", callback=self.saveModel)

        # Status Label
        #box = OWGUI.widgetBox(self.controlArea, "Info ")
        self.info = OWGUI.widgetLabel(self.controlArea, '')
 

        self.applySettings()
        self.adjustSize()
Ejemplo n.º 31
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Nx File", wantMainArea=False)

        self.inputs = []
        self.outputs = [("Network", Orange.network.Graph), ("Items", Orange.data.Table)]
    
        #set default settings
        self.recentFiles = ["(none)"]
        self.recentDataFiles = ["(none)"]
        self.recentEdgesFiles = ["(none)"]
        self.auto_table = False
        
        self.domain = None
        self.graph = None
        self.auto_items = None
        
        #get settings from the ini file, if they exist
        self.loadSettings()

        #GUI
        self.controlArea.layout().setMargin(4)
        self.box = OWGUI.widgetBox(self.controlArea, box = "Graph File", orientation = "vertical")
        hb = OWGUI.widgetBox(self.box, orientation = "horizontal")        
        self.filecombo = OWGUI.comboBox(hb, self, "filename")
        self.filecombo.setMinimumWidth(250)
        button = OWGUI.button(hb, self, '...', callback = self.browseNetFile, disabled=0)
        button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        OWGUI.checkBox(self.box, self, "auto_table", "Build graph data table automatically", callback=lambda: self.selectNetFile(self.filecombo.currentIndex()))
        
        self.databox = OWGUI.widgetBox(self.controlArea, box = "Vertices Data File", orientation = "horizontal")
        self.datacombo = OWGUI.comboBox(self.databox, self, "dataname")
        self.datacombo.setMinimumWidth(250)
        button = OWGUI.button(self.databox, self, '...', callback = self.browseDataFile, disabled=0)
        button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        
        self.edgesbox = OWGUI.widgetBox(self.controlArea, box = "Edges Data File", orientation = "horizontal")
        self.edgescombo = OWGUI.comboBox(self.edgesbox, self, "edgesname")
        self.edgescombo.setMinimumWidth(250)
        button = OWGUI.button(self.edgesbox, self, '...', callback = self.browseEdgesFile, disabled=0)
        button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        
        # info
        box = OWGUI.widgetBox(self.controlArea, "Info")
        self.infoa = OWGUI.widgetLabel(box, 'No data loaded.')
        self.infob = OWGUI.widgetLabel(box, ' ')
        self.infoc = OWGUI.widgetLabel(box, ' ')
        self.infod = OWGUI.widgetLabel(box, ' ')

        OWGUI.rubber(self.controlArea)
        self.resize(150,100)
        self.activateLoadedSettings()

        # connecting GUI to code
        self.connect(self.filecombo, SIGNAL('activated(int)'), self.selectNetFile)
        self.connect(self.datacombo, SIGNAL('activated(int)'), self.selectDataFile)
        self.connect(self.edgescombo, SIGNAL('activated(int)'), self.selectEdgesFile)
Ejemplo n.º 32
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "FeatureConstructor")
        self.inputs = [("Primary Table", orange.ExampleTable, self.setData),
                       ("Additional Tables", orange.ExampleTable,
                        self.setMoreData, Multiple)]
        self.outputs = [("Examples", ExampleTable)]

        self.mergeAttributes = 0
        self.dataSourceSelected = 1
        self.addIdAs = 0
        self.dataSourceName = "clusterId"

        self.primary = None
        self.additional = {}

        self.loadSettings()

        bg = self.bgMerge = OWGUI.radioButtonsInBox(self.controlArea,
                                                    self,
                                                    "mergeAttributes", [],
                                                    "Domains merging",
                                                    callback=self.apply)
        OWGUI.widgetLabel(
            bg, "When there is no primary table, the domain should be")
        OWGUI.appendRadioButton(bg, self, "mergeAttributes",
                                "Union of attributes appearing in all tables")
        OWGUI.appendRadioButton(bg, self, "mergeAttributes",
                                "Intersection of attributes in all tables")
        OWGUI.widgetLabel(
            bg,
            "The resulting table will have class only if there is no conflict betwen input classes."
        )

        box = OWGUI.widgetBox(self.controlArea, "Data source IDs")
        cb = OWGUI.checkBox(box, self, "dataSourceSelected",
                            "Append data source IDs")
        self.classificationBox = ib = OWGUI.widgetBox(box)
        le = OWGUI.lineEdit(ib,
                            self,
                            "dataSourceName",
                            "Name" + "  ",
                            orientation='horizontal',
                            valueType=str)
        OWGUI.separator(ib, height=4)
        aa = OWGUI.comboBox(
            ib,
            self,
            "addIdAs",
            label="Place" + "  ",
            orientation='horizontal',
            items=["Class attribute", "Attribute", "Meta attribute"])
        cb.disables.append(ib)
        cb.makeConsistent()
        OWGUI.separator(box)
        OWGUI.button(box, self, "Apply Changes", callback=self.apply)

        self.adjustSize()
Ejemplo n.º 33
0
    def __init__(self, parent=None, signalManager = None, name='C4.5'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

        self.inputs = [("Examples", ExampleTable, self.setData), ("Preprocess", PreprocessedLearner, self.setPreprocessor)]
        self.outputs = [("Learner", orange.Learner),("Classification Tree", orange.TreeClassifier)]#, ("C45 Tree", orange.C45Classifier)]

        # Settings
        self.name = 'C4.5'
        self.infoGain = 0;  self.subset = 0;       self.probThresh = 0;
        self.useMinObjs = 1; self.minObjs = 2;   self.prune = 1;       self.cf = 25
        self.iterative = 0; self.manualWindow = 0; self.window = 50;     self.manualIncrement = 0;  self.increment = 10;   self.trials = 10

        self.convertToOrange = 1

        self.loadSettings()

        self.data = None                    # input data set
        self.preprocessor = None            # no preprocessing as default

        OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name',
                 tooltip='Name to be used by other widgets to identify your learner/classifier.')
        OWGUI.separator(self.controlArea)

        self.wbSplit = OWGUI.widgetBox(self.controlArea, "Splitting")
        OWGUI.checkBox(self.wbSplit, self, 'infoGain', 'Use information gain instead of ratio (-g)')
        OWGUI.checkBox(self.wbSplit, self, 'subset', 'Subsetting (-s)')
        OWGUI.checkBox(self.wbSplit, self, 'probThresh', 'Probabilistic threshold for continuous attributes (-p)')

        OWGUI.separator(self.controlArea)

        self.wbPruning = OWGUI.widgetBox(self.controlArea, "Pruning")
        OWGUI.checkWithSpin(self.wbPruning, self, 'Minimal examples in leaves (-m)', 1, 1000, 'useMinObjs', 'minObjs', '', 1, labelWidth = 225)
        OWGUI.checkWithSpin(self.wbPruning, self, 'Post pruning with confidence level (-cf) of ', 0, 100, 'prune', 'cf', '', 5, labelWidth = 225)

        OWGUI.separator(self.controlArea)

        self.wbIterative = OWGUI.widgetBox(self.controlArea, "Iterative generation")
        self.cbIterative = OWGUI.checkBox(self.wbIterative, self, 'iterative', 'Generate the tree iteratively (-i, -t, -w)')
        self.spTrial = OWGUI.spin(self.wbIterative, self, 'trials', 1, 30, 1, '', "       Number of trials (-t)", orientation = "horizontal", labelWidth = 225)
        self.csWindow = OWGUI.checkWithSpin(self.wbIterative, self, "Manually set initial window size (-w) to ", 10, 1000, 'manualWindow', 'window', '', 10, labelWidth = 225)
        self.csIncrement = OWGUI.checkWithSpin(self.wbIterative, self, "Manually set window increment (-i) to ", 10, 1000, 'manualIncrement', 'increment', '', 10, labelWidth = 225)

        self.cbIterative.disables = [self.spTrial, self.csWindow, self.csIncrement]
        self.cbIterative.makeConsistent()

#        OWGUI.separator(self.controlArea)

#        OWGUI.checkBox(self.controlArea, self, 'convertToOrange', 'Convert to orange tree structure', box = 1)

        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea, self, "&Apply", callback = self.setLearner, disabled=0)

        OWGUI.rubber(self.controlArea)
        self.setLearner()
Ejemplo n.º 34
0
    def __init__(self,
                 parent=None,
                 signalManager=None,
                 name="Save Classifier"):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          name,
                          wantMainArea=False)

        self.inputs = [("Classifier", orange.Classifier, self.setClassifier)]

        self.lastSaveFile = os.path.expanduser("~/orange_classifier.pck")
        self.filenameHistory = []
        self.selectedFileIndex = 0

        self.loadSettings()

        #####
        # GUI
        #####
        box = OWGUI.widgetBox(self.controlArea,
                              "File",
                              orientation="horizontal",
                              addSpace=True)

        self.filesCombo = OWGUI.comboBox(
            box,
            self,
            "selectedFileIndex",
            items=[os.path.basename(f) for f in self.filenameHistory],
            tooltip="Select a recently saved file",
            callback=self.onRecentSelection)

        self.browseButton = OWGUI.button(box,
                                         self,
                                         "...",
                                         tooltip="Browse local file system",
                                         callback=self.browse)

        self.browseButton.setIcon(self.style().standardIcon(
            QStyle.SP_DirOpenIcon))
        self.browseButton.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)

        box = OWGUI.widgetBox(self.controlArea, "Save")
        self.saveButton = OWGUI.button(box,
                                       self,
                                       "Save current classifier",
                                       callback=self.saveCurrentClassifier)

        self.saveButton.setEnabled(False)

        OWGUI.rubber(self.controlArea)

        self.resize(200, 100)

        self.classifier = None
Ejemplo n.º 35
0
 def createDiscretePalette(self, paletteName, boxCaption, rgbColors = defaultRGBColors):
     vbox = OWGUI.widgetBox(self.mainArea, boxCaption, orientation = 'vertical')
     self.__dict__["disc"+paletteName+"View"] = PaletteView(vbox)
     self.__dict__["disc"+paletteName+"View"].rgbColors = rgbColors
     
     hbox = OWGUI.widgetBox(vbox, orientation = 'horizontal')
     self.__dict__["disc"+paletteName+"EditButt"] = OWGUI.button(hbox, self, "Edit palette", self.editPalette, tooltip = "Edit the order and colors of the palette", debuggingEnabled = 0, toggleButton = 1)
     self.__dict__["disc"+paletteName+"LoadButt"] = OWGUI.button(hbox, self, "Load palette", self.loadPalette, tooltip = "Load a predefined color palette", debuggingEnabled = 0, toggleButton = 1)
     self.discPaletteNames.append(paletteName)
Ejemplo n.º 36
0
    def __init__(self, parent=None, signalManager=None,
                 title="Custom Gene Set Manager"):
        OWWidget.__init__(self, parent, signalManager, title,
                          wantMainArea=True)

        self.inputs = []
        self.outputs = []
        self.new_geneset = set()
        self.selected_file = "" 

        self.browse_button = OWGUI.button(self.controlArea, self, 'Import Gene Sets ...', callback = self.on_open_dialog)
        self.browse_button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))

        # The preview field        
        box = OWGUI.widgetBox(self.controlArea, "Imported Gene Sets")
        self.preview_view = QTreeWidget()
        self.preview_view.setAllColumnsShowFocus(1)
        self.preview_view.setColumnCount(3)
        self.preview_view.setHeaderLabels(["Name", "# of Genes", "Genes"])

        self.preview_view.header().setStretchLastSection(True)
        self.preview_view.header().setClickable(True)
        self.preview_view.header().setSortIndicatorShown(True)
        self.preview_view.setSortingEnabled(True)

        # The geneset table
        ma = self.mainArea

        self.listView = QTreeWidget(ma)

        # Adding the widgets into separate layouts
        ma.layout().addWidget(self.preview_view)
        box.layout().addWidget(self.listView)

        self.listView.setAllColumnsShowFocus(1)
        self.listView.setColumnCount(2)
        self.listView.setHeaderLabels(["Name", "Import time"])

        self.listView.header().setStretchLastSection(True)

        self.listView.setSelectionMode(QAbstractItemView.SingleSelection)
        self.listView.setSelectionBehavior(QAbstractItemView.SelectRows)

        self.populate_table()

        self.resize(800, 500)

        #Data Set info bar
        info_box = OWGUI.widgetBox(self.controlArea, "Info")
        self.info = OWGUI.widgetLabel(info_box, "No gene set selected")
        self.connect(self.listView, SIGNAL("itemSelectionChanged()"), self.selection)
        self.connect(self.listView, SIGNAL("itemSelectionChanged()"), self.update_preview)

        info_box.layout().addWidget(self.info)       
        
        OWGUI.button(self.controlArea, self, "Delete", callback=self.delete_data)
Ejemplo n.º 37
0
    def __init__(self, parent=None, signalManager=None, name='BR-kNN'):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          name,
                          wantMainArea=0,
                          resizingEnabled=0)

        self.callbackDeposit = []

        self.inputs = [("Examples", ExampleTable, self.set_data),
                       ("Preprocess", PreprocessedLearner,
                        self.set_preprocessor)]
        self.outputs = [("Learner", orange.Learner),
                        ("BR-kNN Classifier",
                         Orange.multilabel.BRkNNClassifier)]

        # Settings
        self.name = 'BR-kNN'
        self.k = 1

        self.loadSettings()

        self.data = None  # input data set
        self.preprocessor = None  # no preprocessing as default
        self.set_learner()  # this just sets the learner, no data
        # has come to the input yet

        OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name', \
                 tooltip='Name to be used by other widgets to identify your learner/classifier.')

        OWGUI.separator(self.controlArea)

        wbN = OWGUI.widgetBox(self.controlArea, "Neighbours")
        OWGUI.spin(wbN,
                   self,
                   "k",
                   1,
                   100,
                   1,
                   None,
                   "Number of neighbours",
                   orientation="horizontal")

        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea,
                     self,
                     "&Apply",
                     callback=self.set_learner,
                     disabled=0,
                     default=True)

        OWGUI.rubber(self.controlArea)

        self.resize(100, 250)
Ejemplo n.º 38
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "Regression Tree", wantMainArea = 0, resizingEnabled = 0)
        self.Name="Regression Tree"
        self.MinInstCheck=1
        self.MinInstVal=5
        self.MinNodeCheck=1
        self.MinNodeVal=10
        self.MaxMajCheck=1
        self.MaxMajVal=70
        self.PostMaj=1
        self.PostMPCheck=1
        self.PostMPVal=5
        self.Bin=1
        self.loadSettings()

        self.data=None
        self.preprocessor = None

        self.inputs=[("Data",ExampleTable,self.dataset),
                     ("Preprocess", PreprocessedLearner, self.setPreprocessor)]
        
        self.outputs=[("Learner", orange.Learner),
                      ("Regressor", orange.Classifier),
                      ("Regression Tree", Orange.regression.tree.TreeClassifier)]

        ##
        #GUI
        ##
        OWGUI.lineEdit(self.controlArea, self, "Name", box="Learner/Classifier name")

        OWGUI.separator(self.controlArea)
        OWGUI.checkBox(self.controlArea, self, "Bin", label="Binarization", box ="Tree structure")

        OWGUI.separator(self.controlArea)
        self.prePBox=OWGUI.widgetBox(self.controlArea, "Pre-Pruning")

        #OWGUI.checkWithSpin(self.prePBox, self, "Min. instances in leaves: ", 1, 1000,
        #                    "MinInstCheck", "MinInstVal")

        OWGUI.checkWithSpin(self.prePBox, self, "Do not split nodes with less instances than", 1, 1000,
                            "MinNodeCheck", "MinNodeVal")

        #OWGUI.checkWithSpin(self.prePBox, self, "Stop splitting nodes with ", 1, 100,
        #                    "MaxMajCheck", "MaxMajVal", "% of majority class")

        #OWGUI.checkBox(self.postPBox, self, 'PostMaj', 'Recursively merge leaves with same majority class')

        OWGUI.separator(self.controlArea)
        self.postPBox=OWGUI.widgetBox(self.controlArea, "Post-Pruning")
        OWGUI.checkWithSpin(self.postPBox, self, "Pruning with m-estimate, m:", 0, 1000, 'PostMPCheck', 'PostMPVal')

        OWGUI.button(self.controlArea, self, "&Apply settings", callback=self.setLearner, default=True)
        
        OWGUI.rubber(self.controlArea)
        self.setLearner()
        self.resize(100,100)
Ejemplo n.º 39
0
    def __init__(self, parent=None, signalManager=None,
                 title="Custom Gene Set Manager"):
        OWWidget.__init__(self, parent, signalManager, title,
                          wantMainArea=True)

        self.inputs = []
        self.outputs = []
        self.new_geneset = set()
        self.selected_file = "" 

        self.browse_button = OWGUI.button(self.controlArea, self, 'Import Gene Sets ...', callback = self.on_open_dialog)
        self.browse_button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))

        # The preview field        
        box = OWGUI.widgetBox(self.controlArea, "Imported Gene Sets")
        self.preview_view = QTreeWidget()
        self.preview_view.setAllColumnsShowFocus(1)
        self.preview_view.setColumnCount(3)
        self.preview_view.setHeaderLabels(["Name", "# of Genes", "Genes"])

        self.preview_view.header().setStretchLastSection(True)
        self.preview_view.header().setClickable(True)
        self.preview_view.header().setSortIndicatorShown(True)
        self.preview_view.setSortingEnabled(True)

        # The geneset table
        ma = self.mainArea

        self.listView = QTreeWidget(ma)

        # Adding the widgets into separate layouts
        ma.layout().addWidget(self.preview_view)
        box.layout().addWidget(self.listView)

        self.listView.setAllColumnsShowFocus(1)
        self.listView.setColumnCount(2)
        self.listView.setHeaderLabels(["Name", "Import time"])

        self.listView.header().setStretchLastSection(True)

        self.listView.setSelectionMode(QAbstractItemView.SingleSelection)
        self.listView.setSelectionBehavior(QAbstractItemView.SelectRows)

        self.populate_table()

        self.resize(800, 500)

        #Data Set info bar
        info_box = OWGUI.widgetBox(self.controlArea, "Info")
        self.info = OWGUI.widgetLabel(info_box, "No gene set selected")
        self.connect(self.listView, SIGNAL("itemSelectionChanged()"), self.selection)
        self.connect(self.listView, SIGNAL("itemSelectionChanged()"), self.update_preview)

        info_box.layout().addWidget(self.info)       
        
        OWGUI.button(self.controlArea, self, "Delete", callback=self.delete_data)
Ejemplo n.º 40
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          "Save",
                          wantMainArea=0,
                          resizingEnabled=0)

        self.inputs = [("Data", ExampleTable, self.dataset)]
        self.outputs = []

        self.recentFiles = []
        self.selectedFileName = "None"
        self.data = None
        self.filename = ""
        self.loadSettings()

        #        vb = OWGUI.widgetBox(self.controlArea)

        rfbox = OWGUI.widgetBox(self.controlArea,
                                "Filename",
                                orientation="horizontal",
                                addSpace=True)
        self.filecombo = OWGUI.comboBox(rfbox, self, "filename")
        self.filecombo.setMinimumWidth(200)
        #        browse = OWGUI.button(rfbox, self, "...", callback = self.browseFile, width=25)
        button = OWGUI.button(rfbox,
                              self,
                              '...',
                              callback=self.browseFile,
                              disabled=0)
        button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)

        fbox = OWGUI.widgetBox(self.controlArea, "Save")
        self.save = OWGUI.button(fbox,
                                 self,
                                 "Save",
                                 callback=self.saveFile,
                                 default=True)
        self.save.setDisabled(1)

        OWGUI.rubber(self.controlArea)

        #self.adjustSize()
        self.setFilelist()
        self.resize(260, 100)
        self.filecombo.setCurrentIndex(0)

        if self.selectedFileName != "":
            if os.path.exists(self.selectedFileName):
                self.openFile(self.selectedFileName)
            else:
                self.selectedFileName = ""
Ejemplo n.º 41
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Network File", wantMainArea=False)

        self.inputs = []
        self.outputs = [("Network", orngNetwork.Network), ("Items", ExampleTable)]
    
        #set default settings
        self.recentFiles = ["(none)"]
        self.recentDataFiles = ["(none)"]
        self.recentEdgesFiles = ["(none)"]
        
        self.domain = None
        self.graph = None
        #get settings from the ini file, if they exist
        self.loadSettings()

        #GUI
        self.controlArea.layout().setMargin(4)
        self.box = OWGUI.widgetBox(self.controlArea, box = "Graph File", orientation = "horizontal")
        self.filecombo = OWGUI.comboBox(self.box, self, "filename")
        self.filecombo.setMinimumWidth(250)
        button = OWGUI.button(self.box, self, '...', callback = self.browseNetFile, disabled=0)
        button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        
        self.databox = OWGUI.widgetBox(self.controlArea, box = "Vertices Data File", orientation = "horizontal")
        self.datacombo = OWGUI.comboBox(self.databox, self, "dataname")
        self.datacombo.setMinimumWidth(250)
        button = OWGUI.button(self.databox, self, '...', callback = self.browseDataFile, disabled=0)
        button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        
        self.edgesbox = OWGUI.widgetBox(self.controlArea, box = "Edges Data File", orientation = "horizontal")
        self.edgescombo = OWGUI.comboBox(self.edgesbox, self, "edgesname")
        self.edgescombo.setMinimumWidth(250)
        button = OWGUI.button(self.edgesbox, self, '...', callback = self.browseEdgesFile, disabled=0)
        button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        
        # info
        box = OWGUI.widgetBox(self.controlArea, "Info")
        self.infoa = OWGUI.widgetLabel(box, 'No data loaded.')
        self.infob = OWGUI.widgetLabel(box, ' ')
        self.infoc = OWGUI.widgetLabel(box, ' ')
        self.infod = OWGUI.widgetLabel(box, ' ')

        OWGUI.rubber(self.controlArea)
        self.resize(150,100)
        self.activateLoadedSettings()

        # connecting GUI to code
        self.connect(self.filecombo, SIGNAL('activated(int)'), self.selectNetFile)
        self.connect(self.datacombo, SIGNAL('activated(int)'), self.selectDataFile)
        self.connect(self.edgescombo, SIGNAL('activated(int)'), self.selectEdgesFile)
Ejemplo n.º 42
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "Preprocessing")

        self.inputs = [("Examples", ExampleTable, self.setData)]
        self.outputs = [("Preprocessor", Preprocessor),
                        ("Examples", ExampleTable)]

        OWGUI.button(self.controlArea, self, "Apply", callback=self.apply)

        self.loadSettings()
        self.apply()
        self.adjustSize()
Ejemplo n.º 43
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "FeatureConstructor")

        self.inputs = [("Data", orange.ExampleTable, self.setData)]
        self.outputs = [("Data", ExampleTable)]

        self.expression = self.attrname = ""
        self.selected_def = []
        self.def_labels = []
        self.data = None
        self.definitions = []

        self.selected_features = 0
        self.selectedFunc = 0
        self.autosend = True
        self.loadSettings()

        db = OWGUI.widgetBox(self.controlArea, "Attribute definitions", addSpace=True)

        hb = OWGUI.widgetBox(db, None, "horizontal")
        hbv = OWGUI.widgetBox(hb)
        self.leAttrName = OWGUI.lineEdit(hbv, self, "attrname", "New attribute")
        OWGUI.rubber(hbv)
        vb = OWGUI.widgetBox(hb, None, "vertical", addSpace=True)
        self.leExpression = OWGUI.lineEdit(vb, self, "expression", "Expression")
        hhb = OWGUI.widgetBox(vb, None, "horizontal")
        self.cbAttrs = OWGUI.comboBox(
            hhb, self, "selected_features", items=["(all attributes)"], callback=self.feature_list_selected
        )
        sortedFuncs = sorted(m for m in AttrComputer.FUNCTIONS.keys())
        self.cbFuncs = OWGUI.comboBox(
            hhb, self, "selectedFunc", items=["(all functions)"] + sortedFuncs, callback=self.funcListSelected
        )
        model = self.cbFuncs.model()
        for i, func in enumerate(sortedFuncs):
            model.item(i + 1).setToolTip(inspect.getdoc(AttrComputer.FUNCTIONS[func]))

        hb = OWGUI.widgetBox(db, None, "horizontal", addSpace=True)
        OWGUI.button(hb, self, "Add", callback=self.addAttr, autoDefault=True)
        OWGUI.button(hb, self, "Update", callback=self.updateAttr)
        OWGUI.button(hb, self, "Remove", callback=self.remove_feature)
        OWGUI.button(hb, self, "Remove All", callback=self.remove_all_features)

        self.lbDefinitions = OWGUI.listBox(db, self, "selected_def", "def_labels", callback=self.select_feature)
        self.lbDefinitions.setFixedHeight(160)

        hb = OWGUI.widgetBox(self.controlArea, "Apply", "horizontal")
        OWGUI.button(hb, self, "Apply", callback=self.apply)
        cb = OWGUI.checkBox(hb, self, "autosend", "Apply automatically", callback=self.enableAuto)
        cb.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))

        self.adjustSize()
Ejemplo n.º 44
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "Regression Tree", wantMainArea = 0, resizingEnabled = 0)
        self.Name="Regression Tree"
        self.MinInstCheck=1
        self.MinInstVal=5
        self.MinNodeCheck=1
        self.MinNodeVal=10
        self.MaxMajCheck=1
        self.MaxMajVal=70
        self.PostMaj=1
        self.PostMPCheck=1
        self.PostMPVal=5
        self.Bin=1
        self.loadSettings()

        self.data=None
        self.preprocessor = None

        self.inputs=[("Example Table",ExampleTable,self.dataset), ("Preprocess", PreprocessedLearner, self.setPreprocessor)]
        self.outputs=[("Learner",orange.Learner),("Regressor",orange.Classifier),("Regression Tree",orange.TreeClassifier)]

        ##
        #GUI
        ##
        OWGUI.lineEdit(self.controlArea, self, "Name", box="Learner/Classifier name")

        OWGUI.separator(self.controlArea)
        OWGUI.checkBox(self.controlArea, self, "Bin", label="Binarization", box ="Tree structure")

        OWGUI.separator(self.controlArea)
        self.prePBox=OWGUI.widgetBox(self.controlArea, "Pre-Pruning")

        #OWGUI.checkWithSpin(self.prePBox, self, "Min. instances in leaves: ", 1, 1000,
        #                    "MinInstCheck", "MinInstVal")

        OWGUI.checkWithSpin(self.prePBox, self, "Do not split nodes with less instances than", 1, 1000,
                            "MinNodeCheck", "MinNodeVal")

        #OWGUI.checkWithSpin(self.prePBox, self, "Stop splitting nodes with ", 1, 100,
        #                    "MaxMajCheck", "MaxMajVal", "% of majority class")

        #OWGUI.checkBox(self.postPBox, self, 'PostMaj', 'Recursively merge leaves with same majority class')

        OWGUI.separator(self.controlArea)
        self.postPBox=OWGUI.widgetBox(self.controlArea, "Post-Pruning")
        OWGUI.checkWithSpin(self.postPBox, self, "Pruning with m-estimate, m:", 0, 1000, 'PostMPCheck', 'PostMPVal')

        OWGUI.button(self.controlArea, self, "&Apply settings",callback=self.setLearner)
        
        OWGUI.rubber(self.controlArea)
        self.setLearner()
        self.resize(100,100)
Ejemplo n.º 45
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          "Itemsets",
                          wantMainArea=0)

        from OWItemsets import Itemsets
        self.inputs = [("Data", ExampleTable, self.setData)]
        self.outputs = [("Itemsets", Itemsets)]

        self.minSupport = 60
        self.maxRules = 10000
        self.useSparseAlgorithm = False
        self.loadSettings()

        self.dataset = None

        box = OWGUI.widgetBox(self.space, "Settings", addSpace=True)
        OWGUI.checkBox(box,
                       self,
                       'useSparseAlgorithm',
                       'Use algorithm for sparse data',
                       tooltip="Use original Agrawal's algorithm")
        OWGUI.widgetLabel(box, "Minimal support [%]")
        OWGUI.hSlider(box,
                      self,
                      'minSupport',
                      minValue=1,
                      maxValue=100,
                      ticks=10,
                      step=1)
        OWGUI.separator(box, 0, 0)
        OWGUI.widgetLabel(box, 'Maximal number of rules')
        OWGUI.hSlider(box,
                      self,
                      'maxRules',
                      minValue=10000,
                      maxValue=100000,
                      step=10000,
                      ticks=10000,
                      debuggingEnabled=0)

        OWGUI.button(self.space,
                     self,
                     "&Find Itemsets",
                     self.findItemsets,
                     default=True)

        OWGUI.rubber(self.controlArea)
        self.adjustSize()
Ejemplo n.º 46
0
    def __init__(self, parent=None, signalManager = None, name='kNN'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

        self.inputs = [("Data", ExampleTable, self.setData), ("Preprocess", PreprocessedLearner, self.setPreprocessor)]
        self.outputs = [("Learner", orange.Learner),("kNN Classifier", orange.kNNClassifier)]

        self.metricsList = [("Euclidean", orange.ExamplesDistanceConstructor_Euclidean),
                       ("Hamming", orange.ExamplesDistanceConstructor_Hamming),
                       ("Manhattan", orange.ExamplesDistanceConstructor_Manhattan),
                       ("Maximal", orange.ExamplesDistanceConstructor_Maximal),
#                       ("Dynamic time warp", orange.ExamplesDistanceConstructor_DTW)
                            ]

        # Settings
        self.name = 'kNN'
        self.k = 5;  self.metrics = 0; self.ranks = 0
        self.ignoreUnknowns = 0
        self.normalize = self.oldNormalize = 1
        self.loadSettings()

        self.data = None                    # input data set
        self.preprocessor = None            # no preprocessing as default
        self.setLearner()                   # this just sets the learner, no data
                                            # has come to the input yet

        OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name', \
                 tooltip='Name to be used by other widgets to identify your learner/classifier.')

        OWGUI.separator(self.controlArea)

        wbN = OWGUI.widgetBox(self.controlArea, "Neighbours")
        OWGUI.spin(wbN, self, "k", 1, 100, 1, None, "Number of neighbours   ", orientation="horizontal")
        OWGUI.checkBox(wbN, self, "ranks", "Weighting by ranks, not distances")

        OWGUI.separator(self.controlArea)

        wbM = OWGUI.widgetBox(self.controlArea, "Metrics")
        OWGUI.comboBox(wbM, self, "metrics", items = [x[0] for x in self.metricsList], valueType = int, callback = self.metricsChanged)
        self.cbNormalize = OWGUI.checkBox(wbM, self, "normalize", "Normalize continuous attributes")
        OWGUI.checkBox(wbM, self, "ignoreUnknowns", "Ignore unknown values")
        self.metricsChanged()

        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea, self, "&Apply", callback=self.setLearner, disabled=0, default=True)
        
        OWGUI.rubber(self.controlArea)

        self.resize(100,250)
Ejemplo n.º 47
0
    def __init__(self, parent=None, signalManager = None, name='kNN'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

        self.inputs = [("Examples", ExampleTable, self.setData), ("Preprocess", PreprocessedLearner, self.setPreprocessor)]
        self.outputs = [("Learner", orange.Learner),("KNN Classifier", orange.kNNClassifier)]

        self.metricsList = [("Euclidean", orange.ExamplesDistanceConstructor_Euclidean),
                       ("Hamming", orange.ExamplesDistanceConstructor_Hamming),
                       ("Manhattan", orange.ExamplesDistanceConstructor_Manhattan),
                       ("Maximal", orange.ExamplesDistanceConstructor_Maximal),
#                       ("Dynamic time warp", orange.ExamplesDistanceConstructor_DTW)
                            ]

        # Settings
        self.name = 'kNN'
        self.k = 5;  self.metrics = 0; self.ranks = 0
        self.ignoreUnknowns = 0
        self.normalize = self.oldNormalize = 1
        self.loadSettings()

        self.data = None                    # input data set
        self.preprocessor = None            # no preprocessing as default
        self.setLearner()                   # this just sets the learner, no data
                                            # has come to the input yet

        OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name', \
                 tooltip='Name to be used by other widgets to identify your learner/classifier.')

        OWGUI.separator(self.controlArea)

        wbN = OWGUI.widgetBox(self.controlArea, "Neighbours")
        OWGUI.spin(wbN, self, "k", 1, 100, 1, None, "Number of neighbours   ", orientation="horizontal")
        OWGUI.checkBox(wbN, self, "ranks", "Weighting by ranks, not distances")

        OWGUI.separator(self.controlArea)

        wbM = OWGUI.widgetBox(self.controlArea, "Metrics")
        OWGUI.comboBox(wbM, self, "metrics", items = [x[0] for x in self.metricsList], valueType = int, callback = self.metricsChanged)
        self.cbNormalize = OWGUI.checkBox(wbM, self, "normalize", "Normalize continuous attributes")
        OWGUI.checkBox(wbM, self, "ignoreUnknowns", "Ignore unknown values")
        self.metricsChanged()

        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea, self, "&Apply", callback = self.setLearner, disabled=0)
        
        OWGUI.rubber(self.controlArea)

        self.resize(100,250)
Ejemplo n.º 48
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Concatenate",
                          wantMainArea=False, resizingEnabled=False)
        self.inputs = [("Primary Data", orange.ExampleTable, self.setData),
                       ("Additional Data", orange.ExampleTable, self.setMoreData, Multiple)]
        self.outputs = [("Data", ExampleTable)]

        self.mergeAttributes = 0
        self.dataSourceSelected = 1
        self.addIdAs = 0
        self.dataSourceName = "clusterId"

        self.primary = None
        self.additional = {}
        
        self.loadSettings()
        
        bg = self.bgMerge = OWGUI.radioButtonsInBox(self.controlArea, self, "mergeAttributes", [], "Domains merging", callback = self.apply)
        OWGUI.widgetLabel(bg, "When there is no primary table, the domain should be")
        OWGUI.appendRadioButton(bg, self, "mergeAttributes", "Union of attributes appearing in all tables")
        OWGUI.appendRadioButton(bg, self, "mergeAttributes", "Intersection of attributes in all tables")
        bg.layout().addSpacing(6)
        label = OWGUI.widgetLabel(bg, "The resulting table will have class only if there is no conflict between input classes.")
        label.setWordWrap(True)

        OWGUI.separator(self.controlArea)
        box = OWGUI.widgetBox(self.controlArea, "Data source IDs", addSpace=True)
        cb = OWGUI.checkBox(box, self, "dataSourceSelected", "Append data source IDs")
        self.classificationBox = ib = OWGUI.indentedBox(box, sep=OWGUI.checkButtonOffsetHint(cb))

        form = QFormLayout(
            spacing=8, labelAlignment=Qt.AlignLeft, formAlignment=Qt.AlignLeft,
            fieldGrowthPolicy=QFormLayout.AllNonFixedFieldsGrow
        )
        ib.layout().addLayout(form)

        form.addRow("Name",
                    OWGUI.lineEdit(ib, self, "dataSourceName", valueType=str))

        aa = OWGUI.comboBox(ib, self, "addIdAs", items=["Class attribute", "Attribute", "Meta attribute"])
        cb.disables.append(ib)
        cb.makeConsistent()
        form.addRow("Place", aa)

        OWGUI.button(self.controlArea, self, "Apply Changes", callback = self.apply, default=True)
        
        OWGUI.rubber(self.controlArea)

        self.adjustSize()
        
        self.dataReport = None
Ejemplo n.º 49
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Itemsets explorer")

        self.inputs = [("Itemsets", Itemsets, self.setItemsets)]
        self.outputs = [("Itemsets", Itemsets), ("Data", ExampleTable)]

        self.showWholeItemsets = 1
        self.treeDepth = 2
        self.autoSend = True
        self.dataChanged = False
        self.purgeAttributes = True
        self.purgeClasses = True

        self.nItemsets = self.nSelectedItemsets = self.nSelectedExamples = ""
        self.loadSettings()

        self.treeItemsets = QTreeWidget(self.mainArea)
        self.mainArea.layout().addWidget(self.treeItemsets)
        self.treeItemsets.setSelectionMode (QTreeWidget.ExtendedSelection)
        self.treeItemsets.setHeaderLabels(["Itemsets", "Examples"])
        self.treeItemsets.setAllColumnsShowFocus ( 1)
        self.treeItemsets.setAlternatingRowColors(1) 
        self.treeItemsets.setColumnCount(2) 
        self.connect(self.treeItemsets,SIGNAL("itemSelectionChanged()"),self. selectionChanged)

        box = OWGUI.widgetBox(self.controlArea, "Info", addSpace = True)
        OWGUI.label(box, self, "Number of itemsets: %(nItemsets)s")
        OWGUI.label(box, self, "Selected itemsets: %(nSelectedItemsets)s")
        OWGUI.label(box, self, "Selected examples: %(nSelectedExamples)s")

        box = OWGUI.widgetBox(self.controlArea, "Tree", addSpace = True)
        OWGUI.spin(box, self, "treeDepth", label = "Tree depth", min = 1, max = 10, step = 1, callback = self.populateTree, callbackOnReturn = True)
        OWGUI.checkBox(box, self, "showWholeItemsets", "Display whole itemsets", callback = self.setWholeItemsets)
        OWGUI.button(box, self, "Expand All", callback = lambda: self.treeItemsets.expandAll())
        OWGUI.button(box, self, "Collapse", callback = lambda: self.treeItemsets.collapseAll())

        OWGUI.rubber(self.controlArea)

        boxSettings = OWGUI.widgetBox(self.controlArea, 'Send selection')
        OWGUI.checkBox(boxSettings, self, "purgeAttributes", "Purge attribute values/attributes", box=None, callback=self.purgeChanged)
        self.purgeClassesCB = OWGUI.checkBox(OWGUI.indentedBox(boxSettings), self, "purgeClasses", "Purge class attribute", callback=self.purgeChanged)
        if not self.purgeAttributes:
            self.purgeClassesCB.setEnabled(False)
            self.oldPurgeClasses = False

        cbSendAuto = OWGUI.checkBox(boxSettings, self, "autoSend", "Send immediately", box=None)
        btnUpdate = OWGUI.button(boxSettings, self, "Send", self.sendData, default=True)
        OWGUI.setStopper(self, btnUpdate, cbSendAuto, "dataChanged", self.sendData)

        self.itemsets= None
Ejemplo n.º 50
0
    def __init__(self, *args):
        apply(QDialog.__init__, (self, ) + args)
        self.setWindowTitle("Set Widget Order")
        self.setLayout(QVBoxLayout())

        listbox = OWGUI.widgetBox(self,
                                  1,
                                  orientation="horizontal",
                                  sizePolicy=QSizePolicy(
                                      QSizePolicy.Minimum,
                                      QSizePolicy.Minimum))
        self.tabOrderList = QListWidget(listbox)
        self.tabOrderList.setSelectionMode(QListWidget.SingleSelection)
        listbox.layout().addWidget(self.tabOrderList)

        w = OWGUI.widgetBox(listbox,
                            sizePolicy=QSizePolicy(QSizePolicy.Minimum,
                                                   QSizePolicy.Expanding))
        self.upButton = OWGUI.button(w, self, "Up", callback=self.moveUp)
        self.downButton = OWGUI.button(w, self, "Down", callback=self.moveDown)
        w.layout().addStretch(1)

        hbox = OWGUI.widgetBox(self,
                               orientation="horizontal",
                               sizePolicy=QSizePolicy(QSizePolicy.Minimum,
                                                      QSizePolicy.Fixed))
        OWGUI.button(hbox,
                     self,
                     "Add Separator",
                     callback=self.insertSeparator)
        hbox.layout().addStretch(1)
        OWGUI.button(hbox, self, "&OK", callback=self.accept)
        OWGUI.button(hbox, self, "&Cancel", callback=self.reject)

        self.resize(200, 250)
Ejemplo n.º 51
0
    def __init__(self,parent=None, signalManager = None, name = "Continuizer"):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.inputs = [("Data", ExampleTable, self.setData)]
        self.outputs = [("Data", ExampleTable), ("Preprocessor", PreprocessedLearner)]

        self.multinomialTreatment = 0
        self.targetValue = 0
        self.continuousTreatment = 0
        self.classTreatment = 0
        self.zeroBased = 1
        self.autosend = 0
        self.dataChanged = False
        self.loadSettings()

        bgMultiTreatment = OWGUI.widgetBox(self.controlArea, "Multinomial attributes")
        OWGUI.radioButtonsInBox(bgMultiTreatment, self, "multinomialTreatment", btnLabels=[x[0] for x in self.multinomialTreats], callback=self.sendDataIf)

        self.controlArea.layout().addSpacing(4)

        bgMultiTreatment = OWGUI.widgetBox(self.controlArea, "Continuous attributes")
        OWGUI.radioButtonsInBox(bgMultiTreatment, self, "continuousTreatment", btnLabels=[x[0] for x in self.continuousTreats], callback=self.sendDataIf)

        self.controlArea.layout().addSpacing(4)

        bgClassTreatment = OWGUI.widgetBox(self.controlArea, "Discrete class attribute")
        self.ctreat = OWGUI.radioButtonsInBox(bgClassTreatment, self, "classTreatment", btnLabels=[x[0] for x in self.classTreats], callback=self.sendDataIf)
#        hbox = OWGUI.widgetBox(bgClassTreatment, orientation = "horizontal")
#        OWGUI.separator(hbox, 19, 4)
        hbox = OWGUI.indentedBox(bgClassTreatment, sep=OWGUI.checkButtonOffsetHint(self.ctreat.buttons[-1]), orientation="horizontal")
        self.cbTargetValue = OWGUI.comboBox(hbox, self, "targetValue", label="Target Value ", items=[], orientation="horizontal", callback=self.cbTargetSelected)
        def setEnabled(*args):
            self.cbTargetValue.setEnabled(self.classTreatment == 3)
        self.connect(self.ctreat.group, SIGNAL("buttonClicked(int)"), setEnabled)
        setEnabled() 

        self.controlArea.layout().addSpacing(4)

        zbbox = OWGUI.widgetBox(self.controlArea, "Value range")
        OWGUI.radioButtonsInBox(zbbox, self, "zeroBased", btnLabels=self.valueRanges, callback=self.sendDataIf)

        self.controlArea.layout().addSpacing(4)

        snbox = OWGUI.widgetBox(self.controlArea, "Send data")
        OWGUI.button(snbox, self, "Send data", callback=self.sendData, default=True)
        OWGUI.checkBox(snbox, self, "autosend", "Send automatically", callback=self.enableAuto)
        self.data = None
        self.sendPreprocessor()
        self.resize(150,300)
Ejemplo n.º 52
0
    def __init__(self,parent = None, signalManager = None):
        OWClassificationTreeViewer.__init__(self, parent, signalManager, 'I&nteractive Tree Builder')
        self.inputs = [("Data", ExampleTable, self.setData),
                       ("Tree Learner", orange.Learner, self.setLearner)]
        
        self.outputs = [("Data", ExampleTable),
                        ("Classifier", Orange.classification.tree.TreeClassifier),
                        ("Tree Learner", orange.Learner)]

        self.attridx = 0
        self.cutoffPoint = 0.0
        self.targetClass = 0
        self.loadSettings()

        self.data = None
        self.treeLearner = None
        self.tree = None
        self.learner = None
        
        new_controlArea = OWGUI.widgetBox(self.leftWidgetPart, orientation="vertical", margin=4, addToLayout=False)
        self.leftWidgetPart.layout().insertWidget(0, new_controlArea)
        self.leftWidgetPart.layout().removeWidget(self.controlArea)

        tabWidget = OWGUI.tabWidget(new_controlArea)
        buildTab = OWGUI.createTabPage(tabWidget, "Build")
#        new_controlArea.layout().addWidget(self.controlArea)

        self.old_controlArea = self.controlArea
        displayTab = OWGUI.createTabPage(tabWidget, "Display", self.controlArea)
        self.controlArea = new_controlArea

        self.old_controlArea.layout().removeWidget(self.infBox)
        buildTab.layout().insertWidget(0, self.infBox)
        
        OWGUI.separator(buildTab)
        box = OWGUI.widgetBox(buildTab, "Split selection")
#        OWGUI.widgetLabel(box, "Split By:")
        self.attrsCombo = OWGUI.comboBox(box, self, 'attridx', orientation="horizontal", callback=self.cbAttributeSelected)
        self.cutoffEdit = OWGUI.lineEdit(box, self, 'cutoffPoint', label = 'Cut off point: ', orientation='horizontal', validator=QDoubleValidator(self))
        OWGUI.button(box, self, "Split", callback=self.btnSplitClicked)

        OWGUI.separator(buildTab)
        box = OWGUI.widgetBox(buildTab, "Prune or grow tree")
        self.btnPrune = OWGUI.button(box, self, "Cut", callback = self.btnPruneClicked, disabled = 1)
        self.btnBuild = OWGUI.button(box, self, "Build", callback = self.btnBuildClicked)

        OWGUI.rubber(buildTab)

        self.activateLoadedSettings()
Ejemplo n.º 53
0
    def __init__(self, parent=None, signalManager=None, name='filter'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0)

        self.callbackDeposit = []

        self.inputs = [("Untransformed Data", Histograms, self.setData),
                       ("Labels", Labels, self.setLabels)]
        self.outputs = [("Transformed Data", Histograms)]

        self.useLazyEvaluation = pynopticon.useLazyEvaluation

        # Settings
        self.name = name
        self.transform = None
        self.transidx = 1
        self.transtype = None
        self.transtypes = ['none', 'PCA', 'KPCA', 'LLE']
        self.kernel = None
        self.kernelidx = 1
        self.kerneltypes = ['linear_kernel', 'gaussian_kernel', 'chi2_kernel']
        self.loadSettings()

        self.data = None  # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Transformation Settings")
        self.transcombo = OWGUI.comboBoxWithCaption(wbN,
                                                    self,
                                                    "transidx",
                                                    "Transform type: ",
                                                    items=self.transtypes,
                                                    valueType=int)
        self.kernelcombo = OWGUI.comboBoxWithCaption(wbN,
                                                     self,
                                                     "kernelidx",
                                                     "Kernel type: ",
                                                     items=self.kerneltypes,
                                                     valueType=int)

        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)

        OWGUI.button(self.controlArea,
                     self,
                     "&Apply Settings",
                     callback=self.applySettings,
                     disabled=0)

        self.resize(100, 150)
Ejemplo n.º 54
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "FeatureConstructor")

        self.inputs = [("Examples", orange.ExampleTable, self.setData)]
        self.outputs = [("Examples", ExampleTable)]

        self.expression = self.attrname = ""
        self.selectedDef = []
        self.defLabels = []
        self.data = None
        self.definitions = []

        self.selectedAttr = 0
        self.selectedFunc = 0
        self.autosend = True
        self.loadSettings()

        db = OWGUI.widgetBox(self.controlArea, "Attribute definitions", addSpace = True)

        hb = OWGUI.widgetBox(db, None, "horizontal")
        hbv = OWGUI.widgetBox(hb)
        self.leAttrName = OWGUI.lineEdit(hbv, self, "attrname", "New attribute")
        OWGUI.rubber(hbv)
        vb = OWGUI.widgetBox(hb, None, "vertical", addSpace=True)
        self.leExpression = OWGUI.lineEdit(vb, self, "expression", "Expression")
        hhb = OWGUI.widgetBox(vb, None, "horizontal")
        self.cbAttrs = OWGUI.comboBox(hhb, self, "selectedAttr", items = ["(all attributes)"], callback = self.attrListSelected)
        sortedFuncs = sorted(m for m in list(AttrComputer.FUNCTIONS.keys()))
        self.cbFuncs = OWGUI.comboBox(hhb, self, "selectedFunc", items = ["(all functions)"] + sortedFuncs, callback = self.funcListSelected)
        model = self.cbFuncs.model()
        for i, func in enumerate(sortedFuncs):
            model.item(i + 1).setToolTip(AttrComputer.FUNCTIONS[func].__doc__)
        
        hb = OWGUI.widgetBox(db, None, "horizontal", addSpace=True)
        OWGUI.button(hb, self, "Add", callback = self.addAttr)
        OWGUI.button(hb, self, "Update", callback = self.updateAttr)
        OWGUI.button(hb, self, "Remove", callback = self.removeAttr)
        OWGUI.button(hb, self, "Remove All", callback = self.removeAllAttr)

        self.lbDefinitions = OWGUI.listBox(db, self, "selectedDef", "defLabels", callback=self.selectAttr)
        self.lbDefinitions.setFixedHeight(160)

        hb = OWGUI.widgetBox(self.controlArea, "Apply", "horizontal")
        OWGUI.button(hb, self, "Apply", callback = self.apply)
        cb = OWGUI.checkBox(hb, self, "autosend", "Apply automatically", callback=self.enableAuto)
        cb.setSizePolicy(QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed))

        self.adjustSize()
Ejemplo n.º 55
0
    def __init__(self, parent=None, signalManager=None, name="Load Rules"):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False)
        
        self.outputs = [("Rules", associate.AssociationRules, Dynamic)]
        
        self.filename_history = []
        self.selected_file_index = 0
        self.last_file = os.path.expanduser("~/orange_rules.pck")
        
        self.loadSettings()
        
        self.filename_history= filter(os.path.exists, self.filename_history)
        
        #####
        # GUI
        #####
        
        box = OWGUI.widgetBox(self.controlArea, "File", orientation="horizontal", addSpace=True)
        self.files_combo = OWGUI.comboBox(box, self, "selected_file_index", 
                                         items = [os.path.basename(p) for p in self.filename_history],
                                         tooltip="Select a recent file", 
                                         callback=self.on_recent_selection)
        
        self.browseButton = OWGUI.button(box, self, "...", callback=self.browse,
                                         tooltip = "Browse file system")

        self.browseButton.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        self.browseButton.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        
        OWGUI.rubber(self.controlArea)
        
        self.resize(200, 50)
        
        if self.filename_history:
            self.load_and_send()
Ejemplo n.º 56
0
    def initDestinationPage(self):
        self.optionalMetaDataPage = page = QWizardPage()
        page.setTitle("Destination")
        page.setLayout(QVBoxLayout())
        self.addPage(page)

        self.prepare_only = False
        chk_prepare_only = OWGUI.checkBox(
            page,
            self,
            "prepare_only",
            "Do not pack, only prepare addon.xml and arrange documentation",
            callback=self.callbackPrepareOnlyChange)

        p = OWGUI.widgetBox(page, "Filesystem", orientation="horizontal")
        self.oaofilename = ""
        self.e_oaofilename = OWGUI.lineEdit(p, self, "oaofilename")
        button = OWGUI.button(p,
                              self,
                              '...',
                              callback=self.browseDestinationFile,
                              disabled=0)
        button.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        button.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)

        def initOao(page):
            if not self.oaofilename:
                self.e_oaofilename.setText(self.directory + ".oao")

        page.initializePage = initOao

        p = OWGUI.widgetBox(page, "Repository", orientation="vertical")
        OWGUI.label(
            p, self,
            "Uploading into repositories is not yet implemented, sorry.")
Ejemplo n.º 57
0
    def init_addon_selection_page(self):
        self.addon_selection_page = page = QWizardPage()
        page.setTitle("Add-on Selection")
        page.setLayout(QVBoxLayout())
        self.addPage(page)
        import os

        p = OWGUI.widgetBox(page,
                            "Select a registered add-on to pack",
                            orientation="horizontal")
        self.aolist = OWGUI.listBox(p,
                                    self,
                                    callback=self.list_selection_callback)
        self.registered_addons = Orange.misc.addons.registered_addons
        for ao in self.registered_addons:
            self.aolist.addItem(ao.name)
        pbtn = OWGUI.widgetBox(p, orientation="vertical")
        btn_custom_location = OWGUI.button(
            pbtn,
            self,
            "Custom Location...",
            callback=self.select_custom_location)
        pbtn.layout().addStretch(1)

        self.directory = ""
        self.e_directory = OWGUI.lineEdit(
            page,
            self,
            "directory",
            label="Add-on directory: ",
            callback=self.directory_change_callback,
            callbackOnType=True)
        page.isComplete = lambda page: os.path.isdir(
            os.path.join(self.directory, "widgets"))
Ejemplo n.º 58
0
    def __init__(self):
        QWidget.__init__(self)
        self.setWindowTitle(_("Report"))
        self.setWindowIcon(
            QIcon(os.path.join(redREnviron.widgetDir, "icons/Unknown.png")))
        global report
        if not self.checkExtLibrary():
            report = None
            return

        report = self

        #if not os.path.exists(reportsDir):

        self.setLayout(QVBoxLayout())
        self.layout().setMargin(2)
        self.reportBrowser = OWebView(self)
        self.layout().addWidget(self.reportBrowser)
        self.reportBrowser.setUrl(
            QUrl.fromLocalFile(os.path.join(reportsDir, "index.html")))
        self.counter = 0

        self.tempdir = tempfile.mkdtemp("", "orange-report-")
        hbox = OWGUI.widgetBox(self, orientation=0)
        self.reportButton = OWGUI.button(hbox,
                                         self,
                                         "&Save",
                                         self.saveReport,
                                         width=120)
        OWGUI.rubber(hbox)
Ejemplo n.º 59
0
    def __init__(self, parent=None, signalManager = None, name='Random Forests'):
        OWWidget.__init__(self, parent, signalManager, name)

        self.inputs = [("Examples", ExampleTable, self.setData)]
        self.outputs = [("Learner", orange.Learner),("Random Forests Classifier", orange.Classifier),("Choosen Tree", orange.TreeClassifier) ]

        self.name = 'Random Forests'
	self.trees = 10
	self.attributes = 0
	self.attributesP = 5
	self.preNodeInst = 1
	self.preNodeInstP = 5
	self.limitDepth = 0
	self.limitDepthP = 3
	self.rseed = 0
	self.outtree = 0


	self.maxTrees = 10000

        self.loadSettings()

        self.data = None
        self.preprocessor = None

        OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name', tooltip='Name to be used by other widgets to identify your learner/classifier.')

        OWGUI.separator(self.controlArea)

        self.bBox = QVGroupBox(self.controlArea)
        self.bBox.setTitle('Basic Properties')

        self.treesBox = OWGUI.spin(self.bBox, self, "trees", 1, self.maxTrees, orientation="horizontal", label="Number of trees in forest  ")
	self.attributesBox, self.attributesPBox = OWGUI.checkWithSpin(self.bBox, self, "Consider exactly", 1, 10000, "attributes", "attributesP", " random attributes at each split.")
        self.rseedBox = OWGUI.spin(self.bBox, self, "rseed", 0, 100000, orientation="horizontal", label="Seed for random generator ")

        OWGUI.separator(self.controlArea)

        self.pBox = QVGroupBox(self.controlArea)
        self.pBox.setTitle('Growth Control')

	self.limitDepthBox, self.limitDepthPBox = OWGUI.checkWithSpin(self.pBox, self, "Maximum depth of individual trees  ", 1, 1000, "limitDepth", "limitDepthP", "")
        self.preNodeInstBox, self.preNodeInstPBox = OWGUI.checkWithSpin(self.pBox, self, "Stop splitting nodes with ", 1, 1000, "preNodeInst", "preNodeInstP", " or fewer instances")

        OWGUI.separator(self.controlArea)

        #self.sBox = QVGroupBox(self.controlArea)
        #self.sBox.setTitle('Single Tree Output')

	self.streesBox = OWGUI.spin(self.controlArea, self, "outtree", -1, self.maxTrees, orientation="horizontal", label="Index of tree on the output ", callback=[self.period, self.extree])
	#self.streesBox.setDisabled(True)
	self.streeEnabled(False)

	OWGUI.separator(self.controlArea)

	self.btnApply = OWGUI.button(self.controlArea, self, "&Apply Changes", callback = self.setLearner, disabled=0)

        self.resize(100,200)

	self.setLearner()