Ejemplo n.º 1
0
    def __init__(self, parent=None, signalManager=None):
        self.callbackDeposit = []  # deposit for OWGUI callback functions
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          "Distance File",
                          wantMainArea=0,
                          resizingEnabled=0)

        self.inputs = [("Examples", ExampleTable, self.getExamples, Default)]
        self.outputs = [("Distance Matrix", orange.SymMatrix)]

        self.recentFiles = []
        self.fileIndex = 0
        self.takeAttributeNames = False
        self.data = None
        self.matrix = None
        self.invertDistances = 0
        self.normalizeMethod = 0
        self.invertMethod = 0
        self.loadSettings()
        self.labels = None

        box = OWGUI.widgetBox(self.controlArea, "Data File", addSpace=True)
        hbox = OWGUI.widgetBox(box, orientation=0)
        self.filecombo = OWGUI.comboBox(hbox,
                                        self,
                                        "fileIndex",
                                        callback=self.loadFile)
        self.filecombo.setMinimumWidth(250)
        button = OWGUI.button(hbox, self, '...', callback=self.browseFile)
        button.setMaximumWidth(25)
        self.rbInput = OWGUI.radioButtonsInBox(
            self.controlArea,
            self,
            "takeAttributeNames",
            ["Use examples as items", "Use attribute names"],
            "Items from input data",
            callback=self.relabel)

        self.rbInput.setDisabled(True)
        #
        #        Moved to SymMatrixTransform widget
        #
        #        ribg = OWGUI.radioButtonsInBox(self.controlArea, self, "normalizeMethod", [], "Normalize method", callback = self.setNormalizeMode)
        #        OWGUI.appendRadioButton(ribg, self, "normalizeMethod", "None", callback = self.setNormalizeMode)
        #        OWGUI.appendRadioButton(ribg, self, "normalizeMethod", "To interval [0,1]", callback = self.setNormalizeMode)
        #        OWGUI.appendRadioButton(ribg, self, "normalizeMethod", "Sigmoid function: 1 / (1 + e^x)", callback = self.setNormalizeMode)
        #
        #        ribg = OWGUI.radioButtonsInBox(self.controlArea, self, "invertMethod", [], "Invert method", callback = self.setInvertMode)
        #        OWGUI.appendRadioButton(ribg, self, "invertMethod", "None", callback = self.setInvertMode)
        #        OWGUI.appendRadioButton(ribg, self, "invertMethod", "-X", callback = self.setInvertMode)
        #        OWGUI.appendRadioButton(ribg, self, "invertMethod", "1 - X", callback = self.setInvertMode)
        #        OWGUI.appendRadioButton(ribg, self, "invertMethod", "Max - X", callback = self.setInvertMode)
        #        OWGUI.appendRadioButton(ribg, self, "invertMethod", "1 / X", callback = self.setInvertMode)

        self.adjustSize()

        if self.recentFiles:
            self.loadFile()
Ejemplo n.º 2
0
    def __init__(self, parent = None, signalManager = None, name = "Merge data"):
        OWWidget.__init__(self, parent, signalManager, name)  #initialize base class

        # set channels
        self.inputs = [("Examples A", ExampleTable, self.onDataAInput), ("Examples B", ExampleTable, self.onDataBInput)]
        self.outputs = [("Merged Examples A+B", ExampleTable), ("Merged Examples B+A", ExampleTable)]

        # data
        self.dataA = None
        self.dataB = None
        self.varListA = []
        self.varListB = []
        self.varA = None
        self.varB = None
        self.lbAttrAItems = []
        self.lbAttrBItems = []


        # load settings
        self.loadSettings()
        
        # GUI
        w = QWidget(self)
        self.controlArea.layout().addWidget(w)
        grid = QGridLayout()
        grid.setMargin(0)
        w.setLayout(grid)

        # attribute A
        boxAttrA = OWGUI.widgetBox(self, 'Attribute A', orientation = "vertical", addToLayout=0)
        grid.addWidget(boxAttrA, 0,0)
        self.lbAttrA = OWGUI.listBox(boxAttrA, self, "lbAttrAItems", callback = self.lbAttrAChange)

        # attribute  B
        boxAttrB = OWGUI.widgetBox(self, 'Attribute B', orientation = "vertical", addToLayout=0)
        grid.addWidget(boxAttrB, 0,1)
        self.lbAttrB = OWGUI.listBox(boxAttrB, self, "lbAttrBItems", callback = self.lbAttrBChange)

        # info A
        boxDataA = OWGUI.widgetBox(self, 'Data A', orientation = "vertical", addToLayout=0)
        grid.addWidget(boxDataA, 1,0)
        self.lblDataAExamples = OWGUI.widgetLabel(boxDataA, "num examples")
        self.lblDataAAttributes = OWGUI.widgetLabel(boxDataA, "num attributes")

        # info B
        boxDataB = OWGUI.widgetBox(self, 'Data B', orientation = "vertical", addToLayout=0)
        grid.addWidget(boxDataB, 1,1)
        self.lblDataBExamples = OWGUI.widgetLabel(boxDataB, "num examples")
        self.lblDataBAttributes = OWGUI.widgetLabel(boxDataB, "num attributes")

        # general Info
        boxDataB = OWGUI.widgetBox(self, 'Info', orientation = "vertical", addToLayout=0)
        grid.addWidget(boxDataB, 2,0,1,2)
        self.generalInfo = OWGUI.widgetLabel(boxDataB, "The meta attributes will be present at the output table as regular attributes.")

        # icons
        self.icons = self.createAttributeIconDict()

        # resize
        self.resize(400,500)
Ejemplo n.º 3
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.º 4
0
    def addHistogramControls(self, parent=None):
        # set default settings
        self.spinLowerThreshold = 0
        self.spinLowerChecked = False
        self.spinUpperThreshold = 0
        self.spinUpperChecked = False
        self.netOption = 0
        self.dstWeight = 0
        self.kNN = 0
        self.andor = 0
        self.matrix = None
        self.excludeLimit = 2
        self.percentil = 0

        self.graph = None
        self.graph_matrix = None

        if parent is None:
            parent = self.controlArea

        boxGeneral = OWGUI.widgetBox(parent, box="Distance boundaries")

        ribg = OWGUI.widgetBox(boxGeneral, None, orientation="horizontal", addSpace=False)
        OWGUI.lineEdit(ribg, self, "spinLowerThreshold", "Lower", orientation='horizontal', callback=self.changeLowerSpin, valueType=float, enterPlaceholder=True, controlWidth=100)
        OWGUI.lineEdit(ribg, self, "spinUpperThreshold", "Upper    ", orientation='horizontal', callback=self.changeUpperSpin, valueType=float, enterPlaceholder=True, controlWidth=100)
        ribg.layout().addStretch(1)
        #ribg = OWGUI.radioButtonsInBox(boxGeneral, self, "andor", [], orientation='horizontal', callback = self.generateGraph)
        #OWGUI.appendRadioButton(ribg, self, "andor", "OR", callback = self.generateGraph)
        #b = OWGUI.appendRadioButton(ribg, self, "andor", "AND", callback = self.generateGraph)
        #b.setEnabled(False)
        #ribg.hide(False)

        ribg = OWGUI.widgetBox(boxGeneral, None, orientation="horizontal", addSpace=False)
        OWGUI.spin(ribg, self, "kNN", 0, 1000, 1, label="kNN   ", orientation='horizontal', callback=self.generateGraph, callbackOnReturn=1, controlWidth=100)
        OWGUI.doubleSpin(ribg, self, "percentil", 0, 100, 0.1, label="Percentile", orientation='horizontal', callback=self.setPercentil, callbackOnReturn=1, controlWidth=100)
        ribg.layout().addStretch(1)
        # Options
        self.attrColor = ""
        ribg = OWGUI.radioButtonsInBox(parent, self, "netOption", [], "Options", callback=self.generateGraph)
        OWGUI.appendRadioButton(ribg, self, "netOption", "All vertices", callback=self.generateGraph)
        hb = OWGUI.widgetBox(ribg, None, orientation="horizontal", addSpace=False)
        OWGUI.appendRadioButton(ribg, self, "netOption", "Large components only. Min nodes:", insertInto=hb, callback=self.generateGraph)
        OWGUI.spin(hb, self, "excludeLimit", 2, 100, 1, callback=(lambda h=True: self.generateGraph(h)))
        OWGUI.appendRadioButton(ribg, self, "netOption", "Largest connected component only", callback=self.generateGraph)
        OWGUI.appendRadioButton(ribg, self, "netOption", "Connected component with vertex")
        self.attribute = None
        self.attributeCombo = OWGUI.comboBox(parent, self, "attribute", box="Filter attribute", orientation='horizontal')#, callback=self.setVertexColor)

        ribg = OWGUI.radioButtonsInBox(parent, self, "dstWeight", [], "Distance -> Weight", callback=self.generateGraph)
        hb = OWGUI.widgetBox(ribg, None, orientation="horizontal", addSpace=False)
        OWGUI.appendRadioButton(ribg, self, "dstWeight", "Weight := distance", insertInto=hb, callback=self.generateGraph)
        OWGUI.appendRadioButton(ribg, self, "dstWeight", "Weight := 1 - distance", insertInto=hb, callback=self.generateGraph)

        self.label = ''
        self.searchString = OWGUI.lineEdit(self.attributeCombo.box, self, "label", callback=self.setSearchStringTimer, callbackOnType=True)
        self.searchStringTimer = QTimer(self)
        self.connect(self.searchStringTimer, SIGNAL("timeout()"), self.generateGraph)

        if str(self.netOption) != '3':
            self.attributeCombo.box.setEnabled(False)
Ejemplo n.º 5
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.º 6
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)
    def __init__(self, parent=None, signalManager=None, title="PLS Regression"):
        OWWidget.__init__(self, parent, signalManager, title, wantMainArea=False)
        
        self.inputs = [("Data", Orange.data.Table, self.set_data),
                       ("Preprocessor", PreprocessedLearner, self.set_preprocessor)]
        
        self.outputs = [("Learner", Orange.core.Learner), 
                        ("Predictor", Orange.core.Classifier)]
        
        
        ##########
        # Settings
        ##########
         
        self.name = "PLS Regression"
        self.n_comp = 2
        self.deflation_mode = "Regression"
        self.mode = "PLS"
        self.algorithm = "svd"
        
        self.loadSettings()
        #####
        # GUI
        #####
        
        box = OWGUI.widgetBox(self.controlArea, "Learner/Predictor Name",  
                              addSpace=True)
        
        OWGUI.lineEdit(box, self, "name",
                       tooltip="Name to use for the learner/predictor.")
        
        box = OWGUI.widgetBox(self.controlArea, "Settings", addSpace=True)
        
        OWGUI.spin(box, self, "n_comp", 2, 15, 1, 
                   label="Number of components:", 
                   tooltip="Number of components to keep.")
        
        OWGUI.comboBox(box, self, "deflation_mode", 
                       label="Deflation mode", 
                       items=["Regression", "Canonical"],
#                       tooltip="",
                       sendSelectedValue=True)
        
        OWGUI.comboBox(box, self, "mode", 
                       label="Mode", 
                       items=["PLS", "CCA"],
#                       tooltip="", 
                       sendSelectedValue=True)
        
        OWGUI.rubber(self.controlArea)
        
        OWGUI.button(self.controlArea, self, "&Apply",
                     callback=self.apply,
                     tooltip="Send the learner on",
                     autoDefault=True)
        
        self.data = None
        self.preprocessor = None
        
        self.apply()
Ejemplo n.º 8
0
    def __init__(self, parent=None, signalManager=None, name='Classification Tree'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0, resizingEnabled=0)

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

        self.outputs = [("Learner", Orange.classification.tree.TreeLearner),
                        ("Classification Tree", Orange.classification.tree.TreeClassifier), ]

        self.name = 'Classification Tree'
        self.estim = 0; self.relK = 5; self.relM = 100; self.limitRef = True
        self.bin = 0; self.subset = 0
        self.preLeafInstP = 2; self.preNodeInstP = 5; self.preNodeMajP = 95
        self.preLeafInst = 1; self.preNodeInst = 0; self.preNodeMaj = 0
        self.postMaj = 1; self.postMPruning = 1; self.postM = 2.0
        self.limitDepth = False; self.maxDepth = 100
        self.loadSettings()

        self.data = None
        self.preprocessor = None
        self.setLearner()

        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)

        qBox = OWGUI.widgetBox(self.controlArea, 'Attribute selection criterion')

        self.qMea = OWGUI.comboBox(qBox, self, "estim", items=[m[0] for m in self.measures], callback=self.measureChanged)

        b1 = OWGUI.widgetBox(qBox, orientation="horizontal")
        OWGUI.separator(b1, 16, 0)
        b2 = OWGUI.widgetBox(b1)
        self.cbLimitRef, self.hbxRel1 = OWGUI.checkWithSpin(b2, self, "Limit the number of reference examples to ", 1, 1000, "limitRef", "relM")
        OWGUI.separator(b2)
        self.hbxRel2 = OWGUI.spin(b2, self, "relK", 1, 50, orientation="horizontal", label="Number of neighbours in ReliefF  ")

        OWGUI.separator(self.controlArea)

        OWGUI.radioButtonsInBox(self.controlArea, self, 'bin', self.binarizationOpts, "Binarization")
        OWGUI.separator(self.controlArea)

        self.measureChanged()

        self.pBox = OWGUI.widgetBox(self.controlArea, 'Pre-Pruning')

        self.preLeafInstBox, self.preLeafInstPBox = OWGUI.checkWithSpin(self.pBox, self, "Min. instances in leaves ", 1, 1000, "preLeafInst", "preLeafInstP")
        self.preNodeInstBox, self.preNodeInstPBox = OWGUI.checkWithSpin(self.pBox, self, "Stop splitting nodes with less instances than ", 1, 1000, "preNodeInst", "preNodeInstP")
        self.preNodeMajBox, self.preNodeMajPBox = OWGUI.checkWithSpin(self.pBox, self, "Stop splitting nodes with a majority class of (%)", 1, 100, "preNodeMaj", "preNodeMajP")
        self.cbLimitDepth, self.maxDepthBox = OWGUI.checkWithSpin(self.pBox, self, "Stop splitting nodes at depth", 0, 1000, "limitDepth", "maxDepth")
        OWGUI.separator(self.controlArea)
        self.mBox = OWGUI.widgetBox(self.controlArea, 'Post-Pruning')

        OWGUI.checkBox(self.mBox, self, 'postMaj', 'Recursively merge leaves with same majority class')
        self.postMPruningBox, self.postMPruningPBox = OWGUI.checkWithSpin(self.mBox, self, "Pruning with m-estimate, m=", 0, 1000, 'postMPruning', 'postM')

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

        OWGUI.rubber(self.controlArea)
        self.resize(200, 200)
Ejemplo n.º 9
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
    def __init__(self, parent=None, signalManager = None, name='Random Forest'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False, resizingEnabled=False)

        self.inputs = [("Data", ExampleTable, self.setData),
                       ("Preprocess", PreprocessedLearner, self.setPreprocessor)]
        self.outputs = [("Learner", orange.Learner),
                        ("Random Forest Classifier", orange.Classifier),
                        ("Selected Tree", Orange.classification.tree.TreeClassifier)]

        self.name = 'Random Forest'
        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 = OWGUI.widgetBox(self.controlArea, '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 = OWGUI.widgetBox(self.controlArea, 'Growth Control')

        self.limitDepthBox, self.limitDepthPBox = OWGUI.checkWithSpin(self.pBox, self, "Maximal 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.doBoth, disabled=0, default=True)

        self.resize(100,200)

        self.setLearner()
Ejemplo n.º 11
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.º 12
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.º 13
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)
    def __init__(self,parent=None):
        self.signalManager = orngSignalManager.SignalManager()
        OWBaseWidget.__init__(self, title = 'logistic_regression', signalManager = self.signalManager)
        self.widgets = {}
        self.loadSettings()
        
        self.setLayout(QVBoxLayout())
        self.box = OWGUI.widgetBox(self, 'Widgets')

        self.createWidget('OWFile', 'icons/File.png', 'File', 1, self.signalManager)
        self.createWidget('OWLogisticRegression', 'icons/LogisticRegression.png', 'Logistic Regression', 1, self.signalManager)
        self.createWidget('OWTestLearners', 'icons/TestLearners.png', 'Test Learners', 1, self.signalManager)
        
        box2 = OWGUI.widgetBox(self, 1)
        exitButton = OWGUI.button(box2, self, "Exit", callback = self.accept)
        self.layout().addStretch(100)
        
        statusBar = QStatusBar(self)
        self.layout().addWidget(statusBar)
        self.caption = QLabel('', statusBar)
        self.caption.setMaximumWidth(230)
        self.progress = QProgressBar(statusBar)
        self.progress.setMaximumWidth(100)
        self.status = QLabel("", statusBar)
        self.status.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        statusBar.addWidget(self.progress)
        statusBar.addWidget(self.caption)
        statusBar.addWidget(self.status)

        # add widget signals
        self.signalManager.setFreeze(1)
        self.signalManager.addLink( self.widgets['File'], self.widgets['Test Learners'], 'Examples', 'Data', 1)
        self.signalManager.addLink( self.widgets['Logistic Regression'], self.widgets['Test Learners'], 'Learner', 'Learner', 1)
        self.signalManager.setFreeze(0)
Ejemplo n.º 15
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "AssociationRules", wantMainArea = 0)

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

        self.useSparseAlgorithm = 0
        self.classificationRules = 0
        self.minSupport = 40
        self.minConfidence = 20
        self.maxRules = 10000
        self.loadSettings()

        self.dataset = None

        box = OWGUI.widgetBox(self.space, "Algorithm", addSpace = True)
        self.cbSparseAlgorithm = OWGUI.checkBox(box, self, 'useSparseAlgorithm', 'Use algorithm for sparse data', tooltip="Use original Agrawal's algorithm", callback = self.checkSparse)
        self.cbClassificationRules = OWGUI.checkBox(box, self, 'classificationRules', 'Induce classification rules', tooltip="Induce classification rules")
        self.checkSparse()

        box = OWGUI.widgetBox(self.space, "Pruning", addSpace = True)
        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, 'Minimal confidence [%]')
        OWGUI.hSlider(box, self, 'minConfidence', 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, "&Build rules", self.generateRules)

        OWGUI.rubber(self.controlArea)
        
        self.adjustSize()
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 = [("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)
Ejemplo n.º 17
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.º 18
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.º 19
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.º 20
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.º 21
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.º 22
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.º 23
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.º 24
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.º 25
0
    def __init__(self, parent=None):
        BaseEditor.__init__(self, parent)

        self.measureInd = 0
        self.selectBy = 0
        self.bestN = 10
        self.bestP = 10

        box = OWGUI.radioButtonsInBox(self,
                                      self,
                                      "selectBy", [],
                                      "Feature selection",
                                      callback=self.onChange)

        OWGUI.comboBox(box,
                       self,
                       "measureInd",
                       items=[name for (name, _) in self.MEASURES],
                       label="Measure",
                       callback=self.onChange)

        hbox1 = OWGUI.widgetBox(box, orientation="horizontal", margin=0)
        rb1 = OWGUI.appendRadioButton(box,
                                      self,
                                      "selectBy",
                                      "Best",
                                      insertInto=hbox1,
                                      callback=self.onChange)
        self.spin1 = OWGUI.spin(OWGUI.widgetBox(hbox1),
                                self,
                                "bestN",
                                1,
                                10000,
                                step=1,
                                controlWidth=75,
                                callback=self.onChange,
                                posttext="features")
        OWGUI.rubber(hbox1)

        hbox2 = OWGUI.widgetBox(box, orientation="horizontal", margin=0)
        rb2 = OWGUI.appendRadioButton(box,
                                      self,
                                      "selectBy",
                                      "Best",
                                      insertInto=hbox2,
                                      callback=self.onChange)
        self.spin2 = OWGUI.spin(OWGUI.widgetBox(hbox2),
                                self,
                                "bestP",
                                1,
                                100,
                                step=1,
                                controlWidth=75,
                                callback=self.onChange,
                                posttext="% features")
        OWGUI.rubber(hbox2)

        self.updateSpinStates()

        OWGUI.rubber(box)
Ejemplo n.º 26
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.º 27
0
    def createContinuousPalette(self,
                                paletteName,
                                boxCaption,
                                passThroughBlack=0,
                                initialColor1=QColor(Qt.white),
                                initialColor2=Qt.black):
        buttBox = OWGUI.widgetBox(self.mainArea, boxCaption)
        box = OWGUI.widgetBox(buttBox, orientation="horizontal")

        self.__dict__["cont" + paletteName + "Left"] = ColorButton(
            self, box, color=QColor(initialColor1))
        self.__dict__["cont" + paletteName + "View"] = PaletteView(box)
        self.__dict__["cont" + paletteName + "Right"] = ColorButton(
            self, box, color=QColor(initialColor2))

        self.__dict__["cont" + paletteName +
                      "passThroughBlack"] = passThroughBlack
        self.__dict__["cont" + paletteName +
                      "passThroughBlackCheckbox"] = OWGUI.checkBox(
                          buttBox,
                          self,
                          "cont" + paletteName + "passThroughBlack",
                          "Pass through black",
                          callback=self.colorSchemaChange)
        self.contPaletteNames.append(paletteName)
Ejemplo n.º 28
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'Python Script')

        self.inputs = [("inExampleTable", ExampleTable, self.setExampleTable),
                       ("inDistanceMatrix", orange.SymMatrix,
                        self.setDistanceMatrix),
                       ("inNetwork", orngNetwork.Network, self.setNetwork)]
        self.outputs = [("outExampleTable", ExampleTable),
                        ("outDistanceMatrix", orange.SymMatrix),
                        ("outNetwork", orngNetwork.Network)]

        self.inNetwork = None
        self.inExampleTable = None
        self.inDistanceMatrix = None
        self.codeFile = ''

        self.loadSettings()

        self.infoBox = OWGUI.widgetBox(self.controlArea, 'Info')
        OWGUI.label(
            self.infoBox, self,
            "Execute python script.\n\nInput variables:\n - inExampleTable\n - inDistanceMatrix\n - inNetwork\n\nOutput variables:\n - outExampleTable\n - outDistanceMatrix\n - outNetwork"
        )

        self.controlBox = OWGUI.widgetBox(self.controlArea, 'File')
        OWGUI.button(self.controlBox,
                     self,
                     "Open...",
                     callback=self.openScript)
        OWGUI.button(self.controlBox,
                     self,
                     "Save...",
                     callback=self.saveScript)

        self.runBox = OWGUI.widgetBox(self.controlArea, 'Run')
        OWGUI.button(self.runBox, self, "Execute", callback=self.execute)

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

        self.textBox = OWGUI.widgetBox(self, 'Python script')
        self.splitCanvas.addWidget(self.textBox)
        self.text = QPlainTextEdit(self)
        self.textBox.layout().addWidget(self.text)
        self.text.setFont(QFont("Monospace"))
        self.textBox.setAlignment(Qt.AlignVCenter)
        self.text.setTabStopWidth(4)

        self.consoleBox = OWGUI.widgetBox(self, 'Console')
        self.splitCanvas.addWidget(self.consoleBox)
        self.console = QPlainTextEdit(self)
        self.consoleBox.layout().addWidget(self.console)
        self.console.setFont(QFont("Monospace"))
        self.consoleBox.setAlignment(Qt.AlignBottom)
        self.console.setTabStopWidth(4)

        self.openScript(self.codeFile)

        self.controlArea.layout().addStretch(1)
        self.resize(800, 600)
Ejemplo n.º 29
0
    def __init__(self, parent=None):
        OWWidget.__init__(self, parent, title='X Learner')

        self.method= 0
        self.maxi = 1
        self.cheat = 0
        self.autoApply = True

        self.settingsChanged = False
        
        OWGUI.radioButtonsInBox(self.controlArea, self, "method",
                       ["Vanishing", "Disappearing", "Invisibilisation"],
                       box="Minimization technique", 
                       callback = self.applyIf)
        OWGUI.separator(self.controlArea)

        box = OWGUI.widgetBox(self.controlArea, "Settings")
        OWGUI.checkBox(box, self, "maxi", "Post-maximize", callback = self.applyIf)
        OWGUI.checkBox(box, self, "cheat", "Quasi-cheating", callback = self.applyIf)
        OWGUI.separator(self.controlArea)

        box = OWGUI.widgetBox(self.controlArea, "Apply")
        applyButton = OWGUI.button(box, self, "Apply", callback = self.apply)
        autoApplyCB = OWGUI.checkBox(box, self, "autoApply", "Apply automatically")

        OWGUI.setStopper(self, applyButton, autoApplyCB, "settingsChanged", self.apply)        
        
        self.adjustSize()
Ejemplo n.º 30
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"))
    def __init__(self,parent=None):
        self.signalManager = orngSignalManager.SignalManager()
        OWBaseWidget.__init__(self, title = 'unsupervised1', signalManager = self.signalManager)
        self.widgets = {}
        self.loadSettings()
        
        self.setLayout(QVBoxLayout())
        self.box = OWGUI.widgetBox(self, 'Widgets')

        self.createWidget('OWFile', 'icons/File.png', 'File', 1, self.signalManager)
        self.createWidget('OWDataDomain', 'icons/SelectAttributes.png', 'Select Attributes', 1, self.signalManager)
        self.createWidget('OWDataSampler', 'icons/DataSampler.png', 'Data Sampler', 1, self.signalManager)
        self.createWidget('OWExampleDistance', 'icons/ExampleDistance.png', 'Example Distance', 1, self.signalManager)
        self.createWidget('OWAttributeDistance', 'icons/AttributeDistance.png', 'Attribute Distance', 1, self.signalManager)
        self.createWidget('OWSymMatrixTransform', 'icons/DistanceFile.png', 'Matrix Transformation (2)', 1, self.signalManager)
        self.createWidget('OWDistanceMap', 'icons/DistanceMap.png', 'Distance Map', 1, self.signalManager)
        self.createWidget('OWMDS', 'icons/MDS.png', 'MDS (2)', 1, self.signalManager)
        self.createWidget('OWNetworkFromDistances', 'icons/NetworkFromDistances.png', 'Network from Distances', 1, self.signalManager)
        self.createWidget('OWNetExplorer', 'icons/Network.png', 'Net Explorer (2)', 1, self.signalManager)
        self.createWidget('OWSymMatrixTransform', 'icons/DistanceFile.png', 'Matrix Transformation', 1, self.signalManager)
        self.createWidget('OWDistanceMap', 'icons/DistanceMap.png', 'Distance Map (2)', 1, self.signalManager)
        self.createWidget('OWMDS', 'icons/MDS.png', 'MDS', 1, self.signalManager)
        self.createWidget('OWNetworkFromDistances', 'icons/NetworkFromDistances.png', 'Network from Distances (2)', 1, self.signalManager)
        self.createWidget('OWNetExplorer', 'icons/Network.png', 'Net Explorer', 1, self.signalManager)
        
        box2 = OWGUI.widgetBox(self, 1)
        exitButton = OWGUI.button(box2, self, "Exit", callback = self.accept)
        self.layout().addStretch(100)
        
        statusBar = QStatusBar(self)
        self.layout().addWidget(statusBar)
        self.caption = QLabel('', statusBar)
        self.caption.setMaximumWidth(230)
        self.progress = QProgressBar(statusBar)
        self.progress.setMaximumWidth(100)
        self.status = QLabel("", statusBar)
        self.status.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        statusBar.addWidget(self.progress)
        statusBar.addWidget(self.caption)
        statusBar.addWidget(self.status)

        # add widget signals
        self.signalManager.setFreeze(1)
        self.signalManager.addLink( self.widgets['File'], self.widgets['Select Attributes'], 'Examples', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Select Attributes'], self.widgets['Data Sampler'], 'Examples', 'Data', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Example Distance'], 'Sample', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Attribute Distance'], 'Sample', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Attribute Distance'], self.widgets['Matrix Transformation'], 'Distance Matrix', 'Matrix', 1)
        self.signalManager.addLink( self.widgets['Example Distance'], self.widgets['Matrix Transformation (2)'], 'Distance Matrix', 'Matrix', 1)
        self.signalManager.addLink( self.widgets['Matrix Transformation (2)'], self.widgets['Distance Map'], 'Matrix', 'Distance Matrix', 1)
        self.signalManager.addLink( self.widgets['Matrix Transformation'], self.widgets['Distance Map (2)'], 'Matrix', 'Distance Matrix', 1)
        self.signalManager.addLink( self.widgets['Matrix Transformation'], self.widgets['MDS'], 'Matrix', 'Distances', 1)
        self.signalManager.addLink( self.widgets['Matrix Transformation (2)'], self.widgets['MDS (2)'], 'Matrix', 'Distances', 1)
        self.signalManager.addLink( self.widgets['Matrix Transformation (2)'], self.widgets['Network from Distances'], 'Matrix', 'Distance Matrix', 1)
        self.signalManager.addLink( self.widgets['Matrix Transformation'], self.widgets['Network from Distances (2)'], 'Matrix', 'Distance Matrix', 1)
        self.signalManager.addLink( self.widgets['Network from Distances (2)'], self.widgets['Net Explorer'], 'Network', 'Network', 1)
        self.signalManager.addLink( self.widgets['Network from Distances'], self.widgets['Net Explorer (2)'], 'Network', 'Network', 1)
        self.signalManager.addLink( self.widgets['Matrix Transformation (2)'], self.widgets['Net Explorer (2)'], 'Matrix', 'Vertex Distance', 1)
        self.signalManager.addLink( self.widgets['Matrix Transformation'], self.widgets['Net Explorer'], 'Matrix', 'Vertex Distance', 1)
        self.signalManager.setFreeze(0)
    def __init__(self,parent=None):
        self.signalManager = orngSignalManager.SignalManager()
        OWBaseWidget.__init__(self, title = 'predictions1', signalManager = self.signalManager)
        self.widgets = {}
        self.loadSettings()
        
        self.setLayout(QVBoxLayout())
        self.box = OWGUI.widgetBox(self, 'Widgets')

        self.createWidget('OWFile', 'icons/File.png', 'File', 1, self.signalManager)
        self.createWidget('OWDataSampler', 'icons/DataSampler.png', 'Data Sampler', 1, self.signalManager)
        self.createWidget('OWNaiveBayes', 'icons/NaiveBayes.png', 'Naive Bayes', 1, self.signalManager)
        self.createWidget('OWLogisticRegression', 'icons/LogisticRegression.png', 'Logistic Regression', 1, self.signalManager)
        self.createWidget('OWKNN', 'icons/kNearestNeighbours.png', 'k Nearest Neighbours', 1, self.signalManager)
        self.createWidget('OWClassificationTree', 'icons/ClassificationTree.png', 'Classification Tree', 1, self.signalManager)
        self.createWidget('OWSVM', 'icons/BasicSVM.png', 'SVM', 1, self.signalManager)
        self.createWidget('OWCN2', 'icons/CN2.png', 'CN2', 1, self.signalManager)
        self.createWidget('OWMajority', 'icons/Majority.png', 'Majority', 1, self.signalManager)
        self.createWidget('OWRandomForest', 'icons/RandomForest.png', 'Random Forest', 1, self.signalManager)
        self.createWidget('OWPredictions', 'icons/Predictions.png', 'Predictions', 1, self.signalManager)
        self.createWidget('OWDataTable', 'icons/DataTable.png', 'Data Table', 1, self.signalManager)
        
        box2 = OWGUI.widgetBox(self, 1)
        exitButton = OWGUI.button(box2, self, "Exit", callback = self.accept)
        self.layout().addStretch(100)
        
        statusBar = QStatusBar(self)
        self.layout().addWidget(statusBar)
        self.caption = QLabel('', statusBar)
        self.caption.setMaximumWidth(230)
        self.progress = QProgressBar(statusBar)
        self.progress.setMaximumWidth(100)
        self.status = QLabel("", statusBar)
        self.status.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        statusBar.addWidget(self.progress)
        statusBar.addWidget(self.caption)
        statusBar.addWidget(self.status)

        # add widget signals
        self.signalManager.setFreeze(1)
        self.signalManager.addLink( self.widgets['File'], self.widgets['Data Sampler'], 'Examples', 'Data', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Naive Bayes'], 'Sample', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Logistic Regression'], 'Sample', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['k Nearest Neighbours'], 'Sample', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Classification Tree'], 'Sample', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['SVM'], 'Sample', 'Example Table', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['CN2'], 'Sample', 'Example Table', 1)
        self.signalManager.addLink( self.widgets['k Nearest Neighbours'], self.widgets['Predictions'], 'KNN Classifier', 'Predictors', 1)
        self.signalManager.addLink( self.widgets['Logistic Regression'], self.widgets['Predictions'], 'Classifier', 'Predictors', 1)
        self.signalManager.addLink( self.widgets['Naive Bayes'], self.widgets['Predictions'], 'Naive Bayesian Classifier', 'Predictors', 1)
        self.signalManager.addLink( self.widgets['CN2'], self.widgets['Predictions'], 'Classifier', 'Predictors', 1)
        self.signalManager.addLink( self.widgets['SVM'], self.widgets['Predictions'], 'Classifier', 'Predictors', 1)
        self.signalManager.addLink( self.widgets['Classification Tree'], self.widgets['Predictions'], 'Classification Tree', 'Predictors', 1)
        self.signalManager.addLink( self.widgets['File'], self.widgets['Predictions'], 'Examples', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Predictions'], self.widgets['Data Table'], 'Predictions', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Majority'], 'Sample', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Majority'], self.widgets['Predictions'], 'Classifier', 'Predictors', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Random Forest'], 'Sample', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Random Forest'], self.widgets['Predictions'], 'Random Forest Classifier', 'Predictors', 1)
        self.signalManager.setFreeze(0)
Ejemplo n.º 33
0
 def __init__(self, parent, rgbColors):
     OWBaseWidget.__init__(self, None, None, "Palette Editor", modal = 1)
     self.setLayout(QVBoxLayout(self))
     self.layout().setMargin(4)
     
     hbox = OWGUI.widgetBox(self, "Information" , orientation = 'horizontal')
     OWGUI.widgetLabel(hbox, '<p align="center">You can reorder colors in the list using the<br>buttons on the right or by dragging and dropping the items.<br>To change a specific color double click the item in the list.</p>')
     
     hbox = OWGUI.widgetBox(self, 1, orientation = 'horizontal')
     self.discListbox = OWGUI.listBox(hbox, self, enableDragDrop = 1)
     
     vbox = OWGUI.widgetBox(hbox, orientation = 'vertical')
     buttonUPAttr   = OWGUI.button(vbox, self, "", callback = self.moveAttrUP, tooltip="Move selected colors up")
     buttonDOWNAttr = OWGUI.button(vbox, self, "", callback = self.moveAttrDOWN, tooltip="Move selected colors down")
     buttonUPAttr.setIcon(QIcon(os.path.join(self.widgetDir, "icons/Dlg_up3.png")))
     buttonUPAttr.setSizePolicy(QSizePolicy(QSizePolicy.Fixed , QSizePolicy.Expanding))
     buttonUPAttr.setMaximumWidth(30)
     buttonDOWNAttr.setIcon(QIcon(os.path.join(self.widgetDir, "icons/Dlg_down3.png")))
     buttonDOWNAttr.setSizePolicy(QSizePolicy(QSizePolicy.Fixed , QSizePolicy.Expanding))
     buttonDOWNAttr.setMaximumWidth(30)
     self.connect(self.discListbox, SIGNAL("itemDoubleClicked ( QListWidgetItem *)"), self.changeDiscreteColor)
     
     box = OWGUI.widgetBox(self, 1, orientation = "horizontal")
     OWGUI.button(box, self, "OK", self.accept)
     OWGUI.button(box, self, "Cancel", self.reject)
             
     self.discListbox.setIconSize(QSize(25, 25))
     for ind, (r,g,b) in enumerate(rgbColors):
         item = QListWidgetItem(ColorPixmap(QColor(r,g,b), 25), "Color %d" % (ind+1))
         item.rgbColor = (r,g,b)
         self.discListbox.addItem(item)
         
     self.resize(300, 300)
Ejemplo n.º 34
0
    def __init__(self, parent=None):
        OWWidget.__init__(self, parent, 'Spin')

        # GUI
        self.spinval = 10
        OWGUI.spin(self.controlArea, self, "spinval", 0, 100, box="Value A")
        box = OWGUI.widgetBox(self.controlArea, "Options")
        self.alpha = 30
        self.beta = 4
        OWGUI.spin(box,
                   self,
                   "alpha",
                   0,
                   100,
                   label="Alpha:",
                   labelWidth=60,
                   orientation="horizontal",
                   callback=self.setInfo)
        OWGUI.spin(box,
                   self,
                   "beta",
                   -10,
                   10,
                   label="Beta:",
                   labelWidth=60,
                   orientation="horizontal",
                   callback=self.setInfo)

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

        self.resize(100, 50)
Ejemplo n.º 35
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'SampleDataB')

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

        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.º 36
0
    def init_optional_metadata_page(self):
        self.optionalMetaDataPage = page = QWizardPage()
        page.setTitle("Optional Add-on Information")
        page.setLayout(QVBoxLayout())
        self.addPage( page )

        p = OWGUI.widgetBox(page, "Optionally, enter the following information about your add-on", orientation="vertical")
        self.preferredDir = ""
        self.e_preferreddir = ePreferredDir = OWGUI.lineEdit(p, self, "preferredDir", "Preferred directory name (within add-ons directory; optional):", callback=self.preferred_dir_change_callback, callbackOnType=True)
        self.e_homepage = eHomePage = OWGUI.lineEdit(p, self, None, "Add-on webpage (optional):")
        self.preferred_dir_touched = False
        
        h = OWGUI.widgetBox(p, orientation="horizontal")
        self.e_tags = self.new_textedit("Tags (one per line, optional):", h)
        self.e_aorganizations = self.new_textedit("Contributing organizations (one per line, optional):", h)
        h = OWGUI.widgetBox(p, orientation="horizontal")
        self.e_aauthors = self.new_textedit("Authors (one per line, optional):", h)
        self.e_acontributors = self.new_textedit("Contributors (one per line, optional):", h)
        for noWrapEdit in [self.e_tags, self.e_aauthors, self.e_acontributors, self.e_aorganizations]:
            noWrapEdit.setLineWrapMode(QTextEdit.NoWrap)
        
        def formatList(control, ev):
            entries = control.parseEntries()
            control.setPlainText("\n".join(entries))
            QTextEdit.focusOutEvent(control, ev)
        for listEdit in [self.e_tags, self.e_aauthors, self.e_acontributors, self.e_aorganizations]:
            listEdit.parseEntries = lambda control=listEdit: [entry for entry in map(lambda x: x.strip(), unicode(control.toPlainText()).splitlines()) if entry]
            listEdit.focusOutEvent = formatList
Ejemplo n.º 37
0
    def __init__(self, parent=None, signalManager=None, title="Transpose"):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          title,
                          wantMainArea=False)

        self.inputs = [("Data", Orange.data.Table, self.set_data)]
        self.outputs = [("Transposed Data", Orange.data.Table)]

        # Settings
        self.row_name_attr = None

        box = OWGUI.widgetBox(self.controlArea, "Info")
        self.info_w = OWGUI.widgetLabel(box, "No data on input.")

        box = OWGUI.widgetBox(self.controlArea, "Row Names")
        self.row_name_combo = QComboBox(
            self,
            objectName="row_name_combo",
            toolTip="Row to use for new feature names.",
            activated=self.on_row_name_changed)
        self.row_name_model = VariableOrNoneListModel()
        self.row_name_combo.setModel(self.row_name_model)
        box.layout().addWidget(self.row_name_combo)

        OWGUI.rubber(self.controlArea)
Ejemplo n.º 38
0
    def __init__(self, parent=None, signalManager=None, name="Info"):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0)

        self.inputs = [("Data Table", ExampleTable, self.data)]
        self.rowcount = 0
        self.columncount = 0
        self.discattrcount = 0
        self.contattrcount = 0
        self.stringattrcount = 0
        self.metaattrcount = 0
        self.classattr = "no"

        box = OWGUI.widgetBox(self.controlArea, "Data Set Size")
        OWGUI.label(
            box, self,
            '<table><tr><td width="150">Samples (rows):</td><td align="right" width="60">%(rowcount)7i</td></tr>\
                                <tr><td>Attributes (columns):</td><td align="right">%(columncount)7i</td></tr></table>'
        )

        box = OWGUI.widgetBox(self.controlArea, "Attributes")
        OWGUI.label(
            box, self,
            '<table><tr><td width="150">Discrete attributes:</td><td align="right" width="60">%(discattrcount)7i</td></tr>\
                                <tr><td>Continuous attributes:</td><td align="right">%(contattrcount)7i</td></tr>\
                                <tr><td>String attributes:</td><td align="right">%(stringattrcount)7i</td></tr>\
                                <tr><td> </td></tr>\
                                <tr><td>Meta attributes:</td><td align="right">%(metaattrcount)7i</td></tr>\
                                <tr><td>Class attribute:</td><td align="right">%(classattr)7s</td></tr></table>'
        )
        #        OWGUI.separator(box)
        #        OWGUI.label(box, self, '<table><tr><td width="100">Meta attributes:</td><td align="right" width="50">%(metaattrcount)7i</td></tr>\
        #                                <tr><td>Class attribute:</td><td align="right">%(classattr)7s</td></tr></table>')
        #
        OWGUI.rubber(self.controlArea)
Ejemplo n.º 39
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.º 40
0
    def __init__(self,parent=None, signalManager = None, name = "Impute"):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.inputs = [("Examples", ExampleTable, self.setData, Default), ("Learner for Imputation", orange.Learner, self.setModel)]
        self.outputs = [("Examples", ExampleTable), ("Imputer", orange.ImputerConstructor)]

        self.attrIcons = self.createAttributeIconDict()

        self.defaultMethod = 0
        self.selectedAttr = 0
        self.indiType = 0
        self.imputeClass = 0
        self.autosend = 1
        self.methods = {}
        self.dataChanged = False

        self.model = self.data = None

        self.indiValue = ""
        self.indiValCom = 0

        self.loadSettings()

        self.controlArea.layout().setSpacing(8)
        bgTreat = OWGUI.radioButtonsInBox(self.controlArea, self, "defaultMethod", self.defaultMethods, "Default imputation method", callback=self.sendIf)

        self.indibox = OWGUI.widgetBox(self.controlArea, "Individual attribute settings", "horizontal")

        attrListBox = OWGUI.widgetBox(self.indibox)
        self.attrList = OWGUI.listBox(attrListBox, self, callback = self.individualSelected)
        self.attrList.setMinimumWidth(220)
        self.attrList.setItemDelegate(ImputeListItemDelegate(self, self.attrList))

        indiMethBox = OWGUI.widgetBox(self.indibox)
        indiMethBox.setFixedWidth(160)
        self.indiButtons = OWGUI.radioButtonsInBox(indiMethBox, self, "indiType", ["Default (above)", "Don't impute", "Avg/Most frequent", "Model-based", "Random", "Remove examples", "Value"], 1, callback=self.indiMethodChanged)
        self.indiValueCtrlBox = OWGUI.indentedBox(self.indiButtons)

        self.indiValueLineEdit = OWGUI.lineEdit(self.indiValueCtrlBox, self, "indiValue", callback = self.lineEditChanged)
        #self.indiValueLineEdit.hide()
        valid = QDoubleValidator(self)
        valid.setRange(-1e30, 1e30, 10)
        self.indiValueLineEdit.setValidator(valid)

        self.indiValueComboBox = OWGUI.comboBox(self.indiValueCtrlBox, self, "indiValCom", callback = self.valueComboChanged)
        self.indiValueComboBox.hide()
        OWGUI.rubber(indiMethBox)
        self.btAllToDefault = OWGUI.button(indiMethBox, self, "Set All to Default", callback = self.allToDefault)

        box = OWGUI.widgetBox(self.controlArea, "Class Imputation")
        self.cbImputeClass = OWGUI.checkBox(box, self, "imputeClass", "Impute class values", callback=self.sendIf)

        snbox = OWGUI.widgetBox(self.controlArea, self, "Send data and imputer")
        self.btApply = OWGUI.button(snbox, self, "Apply", callback=self.sendDataAndImputer)
        OWGUI.checkBox(snbox, self, "autosend", "Send automatically", callback=self.enableAuto, disables = [(-1, self.btApply)])

        self.individualSelected(self.selectedAttr)
        self.btApply.setDisabled(self.autosend)
        self.setBtAllToDefault()
        self.resize(200,200)
Ejemplo n.º 41
0
    def __init__(self, parent=None):
        OWWidget.__init__(self, parent, title='Listbox')

        self.method = 0

        self.removeRedundant = self.removeContinuous = self.addNoise = self.classOnly = True
        self.removeClasses = False

        box = OWGUI.widgetBox(self.controlArea, "Redundant values")
        remRedCB = OWGUI.checkBox(box, self, "removeRedundant",
                                  "Remove redundant values")
        iBox = OWGUI.indentedBox(box)
        OWGUI.checkBox(iBox, self, "removeContinuous",
                       "Reduce continuous attributes")
        OWGUI.checkBox(iBox, self, "removeClasses", "Reduce class attribute")
        remRedCB.disables.append(iBox)

        OWGUI.separator(self.controlArea)

        box = OWGUI.widgetBox(self.controlArea, "Noise")
        noiseCB = OWGUI.checkBox(box, self, "addNoise", "Add noise to data")
        classNoiseCB = OWGUI.checkBox(OWGUI.indentedBox(box), self,
                                      "classOnly", "Add noise to class only")
        noiseCB.disables.append(classNoiseCB)

        self.adjustSize()
Ejemplo n.º 42
0
    def __init__(self, parent=None, signalManager=None, name="Info"):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0)
        
        self.inputs = [("Data", ExampleTable, self.data)]
        self.rowcount = 0
        self.columncount = 0
        self.discattrcount = 0
        self.contattrcount = 0
        self.stringattrcount = 0
        self.metaattrcount = 0
        self.classattr = "No"
        
        box = OWGUI.widgetBox(self.controlArea, "Data Set Size", addSpace=True)
        OWGUI.label(box, self, '<table><tr><td width="150">Samples (rows):</td><td align="right" width="60">%(rowcount)7i</td></tr>\
                                <tr><td>Features (columns):</td><td align="right">%(columncount)7i</td></tr></table>')
        
        box = OWGUI.widgetBox(self.controlArea, "Features")
        OWGUI.label(box, self, '<table><tr><td width="150">Discrete:</td><td align="right" width="60">%(discattrcount)7i</td></tr>\
                                <tr><td>Continuous:</td><td align="right">%(contattrcount)7i</td></tr>\
                                <tr><td>String:</td><td align="right">%(stringattrcount)7i</td></tr>\
                                <tr><td> </td></tr>\
                                <tr><td>Meta features:</td><td align="right">%(metaattrcount)7i</td></tr>\
                                <tr><td>Class variable present:</td><td align="right">%(classattr)7s</td></tr></table>')
#        OWGUI.separator(box)
#        OWGUI.label(box, self, '<table><tr><td width="100">Meta attributes:</td><td align="right" width="50">%(metaattrcount)7i</td></tr>\
#                                <tr><td>Class attribute:</td><td align="right">%(classattr)7s</td></tr></table>')
#        
        OWGUI.rubber(self.controlArea)
        self.resize(200, 200)
        
        self.loadSettings()
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "Network from Distances")
        OWNetworkHist.__init__(self)
        
        self.inputs = [("Distances", orange.SymMatrix, self.setMatrix)]
        self.outputs = [("Network", orngNetwork.Network), ("Data", ExampleTable), ("Distances", orange.SymMatrix)]

        self.addHistogramControls()
        
        # get settings from the ini file, if they exist
        self.loadSettings()
        
        # GUI
        # general settings
        boxHistogram = OWGUI.widgetBox(self.mainArea, box = "Distance histogram")
        self.histogram = OWHist(self, boxHistogram)
        boxHistogram.layout().addWidget(self.histogram)

        boxHistogram.setMinimumWidth(500)
        boxHistogram.setMinimumHeight(300)
        
        # info
        boxInfo = OWGUI.widgetBox(self.controlArea, box = "Network info")
        self.infoa = OWGUI.widgetLabel(boxInfo, "No data loaded.")
        self.infob = OWGUI.widgetLabel(boxInfo, '')
        self.infoc = OWGUI.widgetLabel(boxInfo, '')
        
        OWGUI.rubber(self.controlArea)
        
        self.resize(700, 100)
Ejemplo n.º 44
0
    def init_optional_metadata_page(self):
        self.optionalMetaDataPage = page = QWizardPage()
        page.setTitle("Optional Add-on Information")
        page.setLayout(QVBoxLayout())
        self.addPage( page )

        p = OWGUI.widgetBox(page, "Optionally, enter the following information about your add-on", orientation="vertical")
        self.preferredDir = ""
        self.e_preferreddir = ePreferredDir = OWGUI.lineEdit(p, self, "preferredDir", "Preferred directory name (within add-ons directory; optional):", callback=self.preferred_dir_change_callback, callbackOnType=True)
        self.e_homepage = eHomePage = OWGUI.lineEdit(p, self, None, "Add-on webpage (optional):")
        self.preferred_dir_touched = False
        
        h = OWGUI.widgetBox(p, orientation="horizontal")
        self.e_tags = self.new_textedit("Tags (one per line, optional):", h)
        self.e_aorganizations = self.new_textedit("Contributing organizations (one per line, optional):", h)
        h = OWGUI.widgetBox(p, orientation="horizontal")
        self.e_aauthors = self.new_textedit("Authors (one per line, optional):", h)
        self.e_acontributors = self.new_textedit("Contributors (one per line, optional):", h)
        for noWrapEdit in [self.e_tags, self.e_aauthors, self.e_acontributors, self.e_aorganizations]:
            noWrapEdit.setLineWrapMode(QTextEdit.NoWrap)
        
        def formatList(control, ev):
            entries = control.parseEntries()
            control.setPlainText("\n".join(entries))
            QTextEdit.focusOutEvent(control, ev)
        for listEdit in [self.e_tags, self.e_aauthors, self.e_acontributors, self.e_aorganizations]:
            listEdit.parseEntries = lambda control=listEdit: [entry for entry in map(lambda x: x.strip(), unicode(control.toPlainText()).split("\n")) if entry]
            listEdit.focusOutEvent = formatList
Ejemplo n.º 45
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.º 46
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.º 47
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'LearningCurveA')
# [start-snippet-1]
        self.inputs = [("Data", Orange.data.Table, self.set_dataset),
                       ("Learner", Orange.classification.Learner, self.set_learner,
                        Multiple + Default)]
# [end-snippet-1]
        self.folds = 5     # cross validation folds
        self.steps = 10    # points in the learning curve
        self.scoringF = 0  # scoring function
        self.commitOnChange = 1 # compute curve on any change of parameters
        self.loadSettings()
        self.updateCurvePoints() # sets self.curvePoints, self.steps equidistant points from 1/self.steps to 1
# [start-snippet-2]
        self.scoring = [("Classification Accuracy", Orange.evaluation.scoring.CA),
                        ("AUC", Orange.evaluation.scoring.AUC),
                        ("BrierScore", Orange.evaluation.scoring.Brier_score),
                        ("Information Score", Orange.evaluation.scoring.IS),
                        ("Sensitivity", Orange.evaluation.scoring.Sensitivity),
                        ("Specificity", Orange.evaluation.scoring.Specificity)]
# [end-snippet-2]
        self.learners = [] # list of current learners from input channel, tuples (id, learner)
        self.data = None   # data on which to construct the learning curve
        self.curves = []   # list of evaluation results (one per learning curve point)
        self.scores = []   # list of current scores, learnerID:[learner scores]

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

        OWGUI.separator(self.controlArea)

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

        OWGUI.separator(self.controlArea)

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

        OWGUI.rubber(self.controlArea)

        # table widget
        self.table = OWGUI.table(self.mainArea,
                                 selectionMode=QTableWidget.NoSelection)

        self.resize(500,200)
    def __init__(self,parent=None):
        self.signalManager = orngSignalManager.SignalManager()
        OWBaseWidget.__init__(self, title = 'visualizations', signalManager = self.signalManager)
        self.widgets = {}
        self.loadSettings()
        
        self.setLayout(QVBoxLayout())
        self.box = OWGUI.widgetBox(self, 'Widgets')

        self.createWidget('OWFile', 'icons/File.png', 'File', 1, self.signalManager)
        self.createWidget('OWDataSampler', 'icons/DataSampler.png', 'Data Sampler', 1, self.signalManager)
        self.createWidget('OWDataDomain', 'icons/SelectAttributes.png', 'Select Attributes', 1, self.signalManager)
        self.createWidget('OWAttributeStatistics', 'icons/AttributeStatistics.png', 'Attribute Statistics', 1, self.signalManager)
        self.createWidget('OWScatterPlot', 'icons/ScatterPlot.png', 'Scatterplot', 1, self.signalManager)
        self.createWidget('OWLinProj', 'icons/LinearProjection.png', 'Linear Projection', 1, self.signalManager)
        self.createWidget('OWRadviz', 'icons/Radviz.png', 'Radviz', 1, self.signalManager)
        self.createWidget('OWPolyviz', 'icons/Polyviz.png', 'Polyviz', 1, self.signalManager)
        self.createWidget('OWParallelCoordinates', 'icons/ParallelCoordinates.png', 'Parallel coordinates', 1, self.signalManager)
        self.createWidget('OWSurveyPlot', 'icons/SurveyPlot.png', 'Survey Plot', 1, self.signalManager)
        self.createWidget('OWMosaicDisplay', 'icons/MosaicDisplay.png', 'Mosaic Display', 1, self.signalManager)
        self.createWidget('OWSieveDiagram', 'icons/SieveDiagram.png', 'Sieve Diagram', 1, self.signalManager)
        
        box2 = OWGUI.widgetBox(self, 1)
        exitButton = OWGUI.button(box2, self, "Exit", callback = self.accept)
        self.layout().addStretch(100)
        
        statusBar = QStatusBar(self)
        self.layout().addWidget(statusBar)
        self.caption = QLabel('', statusBar)
        self.caption.setMaximumWidth(230)
        self.progress = QProgressBar(statusBar)
        self.progress.setMaximumWidth(100)
        self.status = QLabel("", statusBar)
        self.status.setSizePolicy(QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred))
        statusBar.addWidget(self.progress)
        statusBar.addWidget(self.caption)
        statusBar.addWidget(self.status)

        # add widget signals
        self.signalManager.setFreeze(1)
        self.signalManager.addLink( self.widgets['File'], self.widgets['Data Sampler'], 'Examples', 'Data', 1)
        self.signalManager.addLink( self.widgets['Select Attributes'], self.widgets['Attribute Statistics'], 'Examples', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Select Attributes'], self.widgets['Scatterplot'], 'Examples', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Select Attributes'], self.widgets['Linear Projection'], 'Examples', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Select Attributes'], self.widgets['Radviz'], 'Examples', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Select Attributes'], self.widgets['Polyviz'], 'Examples', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Select Attributes'], self.widgets['Parallel coordinates'], 'Examples', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Select Attributes'], self.widgets['Survey Plot'], 'Examples', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Select Attributes'], self.widgets['Mosaic Display'], 'Examples', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Select Attributes'], self.widgets['Sieve Diagram'], 'Examples', 'Examples', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Linear Projection'], 'Remaining Examples', 'Example Subset', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Scatterplot'], 'Remaining Examples', 'Example Subset', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Radviz'], 'Remaining Examples', 'Example Subset', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Polyviz'], 'Remaining Examples', 'Example Subset', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Parallel coordinates'], 'Remaining Examples', 'Example Subset', 1)
        self.signalManager.addLink( self.widgets['Data Sampler'], self.widgets['Mosaic Display'], 'Remaining Examples', 'Example Subset', 1)
        self.signalManager.addLink( self.widgets['File'], self.widgets['Select Attributes'], 'Examples', 'Examples', 1)
        self.signalManager.setFreeze(0)
Ejemplo n.º 49
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.º 50
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.º 51
0
    def __init__(self, parent=None, signalManager=None, name="Distance File", inputItems=True):
        self.callbackDeposit = [] # deposit for OWGUI callback functions
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 1)
        
        if inputItems: 
            self.inputs = [("Data", ExampleTable, self.getExamples, Default)]
            
        self.outputs = [("Distances", orange.SymMatrix)]

        self.recentFiles=[]
        self.fileIndex = 0
        self.takeAttributeNames = False
        self.data = None
        self.matrix = None
        self.invertDistances = 0
        self.normalizeMethod = 0
        self.invertMethod = 0
        self.loadSettings()
        self.labels = None
        
        
        self.dataFileBox = OWGUI.widgetBox(self.controlArea, "Data File", addSpace=True)
        hbox = OWGUI.widgetBox(self.dataFileBox, orientation = 0)
        self.filecombo = OWGUI.comboBox(hbox, self, "fileIndex", callback = self.loadFile)
        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)
        
        if inputItems: 
            self.rbInput = OWGUI.radioButtonsInBox(self.controlArea, self,
                            "takeAttributeNames", ["Use examples as items", 
                            "Use attribute names"], "Items from input data", 
                            callback = self.relabel)
            
            self.rbInput.setDisabled(True)
    #
#        Moved to SymMatrixTransform widget
#
#        ribg = OWGUI.radioButtonsInBox(self.controlArea, self, "normalizeMethod", [], "Normalize method", callback = self.setNormalizeMode)
#        OWGUI.appendRadioButton(ribg, self, "normalizeMethod", "None", callback = self.setNormalizeMode)
#        OWGUI.appendRadioButton(ribg, self, "normalizeMethod", "To interval [0,1]", callback = self.setNormalizeMode)
#        OWGUI.appendRadioButton(ribg, self, "normalizeMethod", "Sigmoid function: 1 / (1 + e^x)", callback = self.setNormalizeMode)
#        
#        ribg = OWGUI.radioButtonsInBox(self.controlArea, self, "invertMethod", [], "Invert method", callback = self.setInvertMode)
#        OWGUI.appendRadioButton(ribg, self, "invertMethod", "None", callback = self.setInvertMode)
#        OWGUI.appendRadioButton(ribg, self, "invertMethod", "-X", callback = self.setInvertMode)
#        OWGUI.appendRadioButton(ribg, self, "invertMethod", "1 - X", callback = self.setInvertMode)
#        OWGUI.appendRadioButton(ribg, self, "invertMethod", "Max - X", callback = self.setInvertMode)
#        OWGUI.appendRadioButton(ribg, self, "invertMethod", "1 / X", callback = self.setInvertMode)
        
        OWGUI.rubber(self.controlArea)
        
        self.adjustSize()

        if self.recentFiles:
            self.loadFile()
Ejemplo n.º 52
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()
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Confusion Matrix", 1)

        # inputs
        self.inputs=[("Evaluation Results", orngTest.ExperimentResults, self.setTestResults, Default)]
        self.outputs=[("Selected Data", ExampleTable, 8)]

        self.selectedLearner = []
        self.learnerNames = []
        self.selectionDirty = 0
        self.autoApply = True
        self.appendPredictions = True
        self.appendProbabilities = False
        self.shownQuantity = 0

        self.learnerList = OWGUI.listBox(self.controlArea, self, "selectedLearner", "learnerNames", box = "Learners", callback = self.learnerChanged)
        self.learnerList.setMinimumHeight(100)
        
        OWGUI.separator(self.controlArea)

        OWGUI.comboBox(self.controlArea, self, "shownQuantity", items = self.quantities, box = "Show", callback=self.reprint)

        OWGUI.separator(self.controlArea)
        
        box = OWGUI.widgetBox(self.controlArea, "Selection") #, addSpace=True)
        OWGUI.button(box, self, "Correct", callback=self.selectCorrect)
        OWGUI.button(box, self, "Misclassified", callback=self.selectWrong)
        OWGUI.button(box, self, "None", callback=self.selectNone)
        
        OWGUI.separator(self.controlArea)

        self.outputBox = box = OWGUI.widgetBox(self.controlArea, "Output")
        OWGUI.checkBox(box, self, "appendPredictions", "Append class predictions", callback = self.sendIf)
        OWGUI.checkBox(box, self, "appendProbabilities", "Append predicted class probabilities", callback = self.sendIf)
        applyButton = OWGUI.button(box, self, "Commit", callback = self.sendData, default=True)
        autoApplyCB = OWGUI.checkBox(box, self, "autoApply", "Commit automatically")
        OWGUI.setStopper(self, applyButton, autoApplyCB, "selectionDirty", self.sendData)

        import sip
        sip.delete(self.mainArea.layout())
        self.layout = QGridLayout(self.mainArea)

        self.layout.addWidget(OWGUI.widgetLabel(self.mainArea, "Prediction"), 0, 1, Qt.AlignCenter)
        
        label = TransformedLabel("Correct Class")
        self.layout.addWidget(label, 2, 0, Qt.AlignCenter)
#        self.layout.addWidget(OWGUI.widgetLabel(self.mainArea, "Correct Class  "), 2, 0, Qt.AlignCenter)
        self.table = OWGUI.table(self.mainArea, rows = 0, columns = 0, selectionMode = QTableWidget.MultiSelection, addToLayout = 0)
        self.layout.addWidget(self.table, 2, 1)
        self.layout.setColumnStretch(1, 100)
        self.layout.setRowStretch(2, 100)
        self.connect(self.table, SIGNAL("itemSelectionChanged()"), self.sendIf)
        
        self.res = None
        self.matrix = None
        self.selectedLearner = None
        self.resize(700,450)