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

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

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

        self.dataset = None

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

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

        OWGUI.rubber(self.controlArea)
        self.adjustSize()
Ejemplo n.º 2
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "FeatureConstructor")
        # To enable the use of primary table, uncomment the next line  and comment the following one
        # self.inputs = [("Primary Table", dataUtilities.DataTable, self.setData), ("Additional Tables", dataUtilities.DataTable, self.setMoreData, Multiple)]
        self.inputs = [("Tables", orange.ExampleTable, self.setMoreData, Multiple)]

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

        self.mergeAttributes = 0
        self.primary = None
        self.additional = {}

        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.")

        infoBox = OWGUI.widgetBox(self, "Concatenate status")
        self.infoStatus = OWGUI.widgetLabel(infoBox, "")

        self.viewBT = OWGUI.button(
            self.controlArea,
            self,
            "&View converted incompatible attributes",
            callback=self.viewIncompatible,
            disabled=1,
        )

        self.adjustSize()
Ejemplo n.º 3
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.º 4
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.º 5
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.º 6
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.º 7
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)
    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.º 9
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          "Concatenate",
                          wantMainArea=0)
        self.inputs = [("Primary Table", orange.ExampleTable, self.setData),
                       ("Additional Tables", orange.ExampleTable,
                        self.setMoreData, Multiple)]
        self.outputs = [("Examples", ExampleTable)]

        self.mergeAttributes = 0

        self.primary = None
        self.additional = {}

        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 between input classes."
        )

        self.adjustSize()
Ejemplo n.º 10
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.º 11
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)
Ejemplo n.º 12
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "FeatureConstructor")
        self.inputs = [("Primary Table", orange.ExampleTable, self.setData),
                       ("Additional Tables", orange.ExampleTable,
                        self.setMoreData, Multiple)]
        self.outputs = [("Examples", ExampleTable)]

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

        self.primary = None
        self.additional = {}

        self.loadSettings()

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

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

        self.adjustSize()
Ejemplo n.º 13
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'FastaConverter')
        self.inputs = [("convertFastaTab", ExampleTable, self.convertFastaTab)]
        self.outputs = [("Tab File", ExampleTable)]

        # GUI
        box = OWGUI.widgetBox(self.controlArea, "Info")
        self.infoa = OWGUI.widgetLabel(box, 'No fasta file yet, waiting to get something.')
        self.infob = OWGUI.widgetLabel(box, '')
        self.resize(100,50)
Ejemplo n.º 14
0
    def __init__(self, *args):
        apply(QDialog.__init__, (self, ) + args)
        self.topLayout = QVBoxLayout(self)
        self.setWindowFlags(Qt.Popup)

        import orngEnviron
        logoImage = QPixmap(
            os.path.join(orngEnviron.directoryNames["canvasDir"], "icons",
                         "splash.png"))
        logo = OWGUI.widgetLabel(self, "")
        logo.setPixmap(logoImage)

        OWGUI.widgetLabel(self, '<p align="center"><h2>Orange</h2></p>')

        try:
            import orange
            version = orange.version.split("(")[0].strip()
            date = orange.version.split(",")[-1].strip(" )")
            OWGUI.widgetLabel(self,
                              '<p align="center">version %s</p>' % (version))
            OWGUI.widgetLabel(self,
                              '<p align="center">(built %s)</p>' % (date))
        except:
            pass
        OWGUI.widgetLabel(self, "")
        #OWGUI.button(self, self, "Close", callback = self.accept)
        b = QDialogButtonBox(self)
        b.setCenterButtons(1)
        self.layout().addWidget(b)
        butt = b.addButton(QDialogButtonBox.Close)
        self.connect(butt, SIGNAL("clicked()"), self.accept)
Ejemplo n.º 15
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'SampleDataA')
        
        self.inputs = [("Data", ExampleTable, self.data)]
        self.outputs = [("Sampled Data", ExampleTable)]

        # 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, '')
        self.resize(100,50)
Ejemplo n.º 16
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'ConceptCloud')

        self.inputs = [("TEST1", WidgetChannelData, self.data)]
        self.outputs = [("TEST2", WidgetChannelData)]

        # GUI
        box = OWGUI.widgetBox(self.controlArea, u"信息")
        self.infoa = OWGUI.widgetLabel(box, u'万事俱备,只欠东风。')
        self.infob = OWGUI.widgetLabel(box, u'再见')
        self.resize(100, 50)
Ejemplo n.º 17
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'SampleDataA')
        
        self.inputs = [("Data", ExampleTable, self.oneR)]
        self.outputs = [("Sampled Data", ExampleTable)]

        # GUI
        box = OWGUI.widgetBox( self.controlArea, "Info" )
        self.infoa = OWGUI.widgetLabel( box, 'No input data; waiting for the input signal (A).' )
        self.infob = OWGUI.widgetLabel( box, '' )
        self.resize( 100, 50 )
Ejemplo n.º 18
0
 def __init__(self, parent=None, signalManager=None):
     OWWidget.__init__(self, parent, signalManager, 'ConceptNet')
     
     self.inputs = [("TEST1", WidgetChannelData, self.data)]
     self.outputs = [("TEST2", WidgetChannelData)]
     
     # GUI
     box = OWGUI.widgetBox(self.controlArea, u"信息")
     self.infoa = OWGUI.widgetLabel(box, u'万事俱备,只欠东风。')
     self.infob = OWGUI.widgetLabel(box, u'再见')
     self.resize(100,50) 
Ejemplo n.º 19
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Network File", wantMainArea=False)

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

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

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

        # connecting GUI to code
        self.connect(self.filecombo, SIGNAL('activated(int)'), self.selectNetFile)
        self.connect(self.datacombo, SIGNAL('activated(int)'), self.selectDataFile)
        self.connect(self.edgescombo, SIGNAL('activated(int)'), self.selectEdgesFile)
Ejemplo n.º 20
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'Bio-File')
        
        #self.inputs = [("Data", ExampleTable, self.data)]
        self.outputs = [("Sampled Data", ExampleTable)]

        # GUI
        box = OWGUI.widgetBox(self.controlArea, "Info")
        self.infoa = OWGUI.widgetLabel(box, 'File tool to help import, organize, and manipulate data of various file types from within orange.')
        self.infob = OWGUI.widgetLabel(box, '')
        self.resize(100,50)
Ejemplo n.º 21
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager)

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

        # 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, '')
        self.resize(100, 50)
Ejemplo n.º 22
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Concatenate",
                          wantMainArea=False, resizingEnabled=False)
        self.inputs = [("Primary Data", orange.ExampleTable, self.setData),
                       ("Additional Data", orange.ExampleTable, self.setMoreData, Multiple)]
        self.outputs = [("Data", ExampleTable)]

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

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

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

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

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

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

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

        self.adjustSize()
        
        self.dataReport = None
Ejemplo n.º 23
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.º 24
0
    def __init__(self, parent=None, signalManager=None, title="Array Express"):
        OWWidget.__init__(self, parent, signalManager, title)

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

        self.loadSettings()

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

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

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

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

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

        self.experiments_view.setModel(model)

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

        self.setEnabled(False)
        QTimer.singleShot(5, self.fill_experiments)
Ejemplo n.º 25
0
    def defineGUI(self):

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

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

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

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

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

        self.applySettings()
        self.adjustSize()
Ejemplo n.º 26
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'Network Clustering')

        self.inputs = [("Network", orngNetwork.Network, self.setNetwork,
                        Default)]
        self.outputs = [("Network", orngNetwork.Network)]

        self.net = None
        self.method = 0
        self.iterationHistory = 0
        self.autoApply = 0

        self.loadSettings()

        ribg = OWGUI.radioButtonsInBox(self.controlArea,
                                       self,
                                       "method", [],
                                       "Method",
                                       callback=self.cluster)
        OWGUI.appendRadioButton(
            ribg,
            self,
            "method",
            "Label propagation clustering (Raghavan et al., 2007)",
            callback=self.cluster)
        OWGUI.checkBox(OWGUI.indentedBox(ribg),
                       self,
                       "iterationHistory",
                       "Append clustering data on each iteration",
                       callback=self.cluster)
        self.info = OWGUI.widgetLabel(self.controlArea, ' ')
        autoApplyCB = OWGUI.checkBox(self.controlArea, self, "autoApply",
                                     "Commit automatically")
        OWGUI.button(self.controlArea, self, "Commit", callback=self.cluster)
Ejemplo n.º 27
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.º 28
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.º 29
0
    def __init__(self, parent=None, signalManager=None, title="Array Express"):
        OWWidget.__init__(self, parent, signalManager, title)

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

        self.loadSettings()

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

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

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

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

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

        self.experiments_view.setModel(model)

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

        self.setEnabled(False)
        QTimer.singleShot(5, self.fill_experiments)
Ejemplo n.º 30
0
    def __init__(self, graph, extraButtons = [], defaultName="graph", parent=None, saveMatplotlib=None):
        OWBaseWidget.__init__(self, parent, None, "Image settings", modal = TRUE, resizingEnabled = 0)

        self.graph = graph
        self.selectedSize = 0
        self.customX = 400
        self.customY = 400
        self.saveAllSizes = 0
        self.penWidthFactor = 1
        self.lastSaveDirName = "./"
        self.defaultName = defaultName

        self.loadSettings()

        self.setLayout(QVBoxLayout(self))
        self.space = OWGUI.widgetBox(self)
        self.layout().setMargin(8)
        #self.layout().addWidget(self.space)

        box = OWGUI.widgetBox(self.space, "Image Size")

        global _have_qwt
        if _have_qwt and isinstance(graph, QwtPlot):
            size = OWGUI.radioButtonsInBox(box, self, "selectedSize", ["Current size", "400 x 400", "600 x 600", "800 x 800", "Custom:"], callback = self.updateGUI)
            self.customXEdit = OWGUI.lineEdit(OWGUI.indentedBox(box), self, "customX", "Width: ", orientation = "horizontal", valueType = int)
            self.customYEdit = OWGUI.lineEdit(OWGUI.indentedBox(box), self, "customY", "Height:", orientation = "horizontal", valueType = int)
            OWGUI.comboBoxWithCaption(self.space, self, "penWidthFactor", label = 'Factor:   ', box = " Pen width multiplication factor ",  tooltip = "Set the pen width factor for all curves in the plot\n(Useful for example when the lines in the plot look to thin)\nDefault: 1", sendSelectedValue = 1, valueType = int, items = range(1,20))
        elif isinstance(graph, QGraphicsScene) or isinstance(graph, QGraphicsView) or (_have_gl and isinstance(graph, QGLWidget)):
            OWGUI.widgetLabel(box, "Image size will be set automatically.")

        box = OWGUI.widgetBox(self.space, 1)
        #self.printButton =          OWGUI.button(self.space, self, "Print", callback = self.printPic)
        self.saveImageButton =      OWGUI.button(box, self, "Save Image", callback = self.saveImage)

        # If None we try to determine if save can succeed automatically
        if saveMatplotlib is None:
            saveMatplotlib = self.canSaveToMatplotlib(graph)

        if saveMatplotlib and not (_have_gl and isinstance(graph, QGLWidget)):
            self.saveMatplotlibButton = OWGUI.button(box, self, "Save Graph as matplotlib Script", callback = self.saveToMatplotlib)
        for (text, funct) in extraButtons:
            butt = OWGUI.button(box, self, text, callback = funct)
            self.connect(butt, SIGNAL("clicked()"), self.accept)        # also connect the button to accept so that we close the dialog
        OWGUI.button(box, self, "Cancel", callback = self.reject)

        self.resize(250,300)
        self.updateGUI()
Ejemplo n.º 31
0
    def __init__(self, parent=None, signalManager = None, name='ML-kNN'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

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

        # Settings
        self.name = 'ML-kNN'
        self.k = 1
        self.smooth = 1.0
        
        self.loadSettings()

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

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

        OWGUI.separator(self.controlArea)

        wbN = OWGUI.widgetBox(self.controlArea, "Neighbours")
        OWGUI.spin(wbN, self, "k", 1, 100, 1, None, "Number of neighbours", orientation="horizontal")
        
        OWGUI.separator(self.controlArea)
        OWGUI.widgetLabel(self.controlArea, 'Smoothing parameter')
        kernelSizeValid = QDoubleValidator(self.controlArea)
        kernelSizeValid.setRange(0,10,3)
        OWGUI.lineEdit(self.controlArea, self, 'smooth',
                       tooltip='Smoothing parameter controlling the strength of uniform prior (Default value is set to 1 which yields the Laplace smoothing).',
                       valueType = float, validator = kernelSizeValid)
                       
        OWGUI.separator(self.controlArea)

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

        self.resize(100,250)
Ejemplo n.º 32
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          "FeatureConstructor",
                          wantMainArea=0)
        self.inputs = [("Examples", ExampleTable, self.setData)]
        self.outputs = [("Examples", ExampleTable)]

        self.newName = "NEW_CLASS"
        self.value = "?"
        self.values = "[]"
        self.data = None

        box = OWGUI.widgetBox(self.controlArea, "Add discrete class")
        newNameBox = OWGUI.lineEdit(
            box,
            self,
            "newName",
            "Class name: ",
            labelWidth=70,
            orientation="horizontal",
            tooltip="Name of the new Class attribute to be added")
        valueBox = OWGUI.lineEdit(
            box,
            self,
            "value",
            "Value: ",
            labelWidth=70,
            orientation="horizontal",
            tooltip="Class value to be assigned to each example")
        #valuesBox = OWGUI.lineEdit(box, self, "values", "Class values: ", labelWidth=70, orientation="horizontal", tooltip='Optional, list of possible values of new discrete class attribute ex: ["POS", "NEG"]')

        self.BT = OWGUI.button(self.controlArea,
                               self,
                               "&Apply",
                               callback=self.apply,
                               disabled=0)
        infoBox = OWGUI.widgetBox(self, "Info")
        OWGUI.widgetLabel(
            infoBox,
            'Adds a new discrete response variable\nto the data and gives all examples the same value.'
        )

        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)
Ejemplo n.º 34
0
 def __init__(self):
     OWBaseWidget.__init__(self, None, None, "Color Palette List", modal = 1)
     self.setLayout(QVBoxLayout(self))
     self.layout().setMargin(0)
     sa = QScrollArea()
     sa.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
     sa.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOn)
     self.layout().addWidget(sa)
     
     space = QWidget(self)
     space.setLayout(QVBoxLayout())
     sa.setWidget(space)
     sa.setWidgetResizable(1)        # this is crucial in order for the scrollarea to work - otherwise the content is not visible!!!
     
     self.buttons = []
     self.setMinimumWidth(400)
     
     from ColorBrewerColorSchemes import colorSchemes
         
     box = OWGUI.widgetBox(space, "Information", addSpace = True, orientation="vertical")
     OWGUI.widgetLabel(box, '<p align="center">This dialog shows a list of predefined color palettes <br>from colorbrewer.org that can be used in Orange.<br>You can select a palette by clicking on it.</p>')
     
     box = OWGUI.widgetBox(space, "Default Palette", addSpace = True, orientation="vertical")
     butt = OWGUI.button(box, self, "", self.buttClicked, tooltip = "Default color palette", toggleButton = 1)
     butt.rgbColors = defaultRGBColors
     butt.setIcon(QIcon(createDiscPalettePixmap(butt.iconSize().width(), butt.iconSize().height(), defaultRGBColors)))
     self.buttons.append(butt)
     
     for type in ["Qualitative", "Spectral", "Diverging", "Sequential", "Pastels"]:
         colorGroup = colorSchemes.get(type.lower(), {})
         if colorGroup != {}:
             box = OWGUI.widgetBox(space, type + " Palettes", addSpace = True, orientation="vertical")
             keys = colorGroup.keys()
             keys.sort()
             for key in keys:
                 butt = OWGUI.button(box, self, "", self.buttClicked, tooltip = key, toggleButton = 1)
                 butt.rgbColors = colorGroup[key]
                 self.buttons.append(butt)
                 
     box = OWGUI.widgetBox(space, 1, orientation = "horizontal")
     #OWGUI.button(box, self, "OK", self.accept)
     OWGUI.button(box, self, "Cancel", self.reject)
     
     self.resize(300, 400)
Ejemplo n.º 35
0
    def __init__(self, parent=None, signalManager=None,
                 title="Custom Gene Set Manager"):
        OWWidget.__init__(self, parent, signalManager, title,
                          wantMainArea=True)

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

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

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

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

        # The geneset table
        ma = self.mainArea

        self.listView = QTreeWidget(ma)

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

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

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

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

        self.populate_table()

        self.resize(800, 500)

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

        info_box.layout().addWidget(self.info)       
        
        OWGUI.button(self.controlArea, self, "Delete", callback=self.delete_data)
Ejemplo n.º 36
0
    def __init__(self, parent=None, signalManager=None,
                 title="Custom Gene Set Manager"):
        OWWidget.__init__(self, parent, signalManager, title,
                          wantMainArea=True)

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

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

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

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

        # The geneset table
        ma = self.mainArea

        self.listView = QTreeWidget(ma)

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

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

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

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

        self.populate_table()

        self.resize(800, 500)

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

        info_box.layout().addWidget(self.info)       
        
        OWGUI.button(self.controlArea, self, "Delete", callback=self.delete_data)
Ejemplo n.º 37
0
    def __init__(self, graph, extraButtons = [], defaultName="graph", parent=None):
        OWBaseWidget.__init__(self, parent, None, "Image settings", modal = TRUE, resizingEnabled = 0)

        self.graph = graph
        self.selectedSize = 0
        self.customX = 400
        self.customY = 400
        self.saveAllSizes = 0
        self.penWidthFactor = 1
        self.lastSaveDirName = "./"
        self.defaultName = defaultName

        self.loadSettings()

        self.setLayout(QVBoxLayout(self))
        self.space = OWGUI.widgetBox(self)
        self.layout().setMargin(8)
        #self.layout().addWidget(self.space)

        box = OWGUI.widgetBox(self.space, "Image Size")

        global _have_qwt
        if _have_qwt and isinstance(graph, QwtPlot):
            size = OWGUI.radioButtonsInBox(box, self, "selectedSize", ["Current size", "400 x 400", "600 x 600", "800 x 800", "Custom:"], callback = self.updateGUI)
            self.customXEdit = OWGUI.lineEdit(OWGUI.indentedBox(box), self, "customX", "Width: ", orientation = "horizontal", valueType = int)
            self.customYEdit = OWGUI.lineEdit(OWGUI.indentedBox(box), self, "customY", "Height:", orientation = "horizontal", valueType = int)
            OWGUI.comboBoxWithCaption(self.space, self, "penWidthFactor", label = 'Factor:   ', box = " Pen width multiplication factor ",  tooltip = "Set the pen width factor for all curves in the plot\n(Useful for example when the lines in the plot look to thin)\nDefault: 1", sendSelectedValue = 1, valueType = int, items = range(1,20))
        elif isinstance(graph, QGraphicsScene) or isinstance(graph, QGraphicsView) or (_have_gl and isinstance(graph, QGLWidget)):
            OWGUI.widgetLabel(box, "Image size will be set automatically.")

        box = OWGUI.widgetBox(self.space, 1)
        #self.printButton =          OWGUI.button(self.space, self, "Print", callback = self.printPic)
        self.saveImageButton =      OWGUI.button(box, self, "Save Image", callback = self.saveImage)
        if not (_have_gl and isinstance(graph, QGLWidget)):
            self.saveMatplotlibButton = OWGUI.button(box, self, "Save Graph as matplotlib Script", callback = self.saveToMatplotlib)
        for (text, funct) in extraButtons:
            butt = OWGUI.button(box, self, text, callback = funct)
            self.connect(butt, SIGNAL("clicked()"), self.accept)        # also connect the button to accept so that we close the dialog
        OWGUI.button(box, self, "Cancel", callback = self.reject)

        self.resize(250,300)
        self.updateGUI()
Ejemplo n.º 38
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'LearningCurveA')

        self.inputs = [("Data", ExampleTable, self.dataset),
                       ("Learner", orange.Learner, self.learner, Multiple)]
        
        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.setCurvePoints() # sets self.curvePoints, self.steps equidistantpoints from 1/self.steps to 1
        self.scoring = [("Classification Accuracy", orngStat.CA), ("AUC", orngStat.AUC), ("BrierScore", orngStat.BrierScore), ("Information Score", orngStat.IS), ("Sensitivity", orngStat.sens), ("Specificity", orngStat.spec)]
        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(self.commitOnChange))
        OWGUI.spin(box, self, 'steps', 2, 100, step=1, label='Learning curve points:  ',
                   callback=[self.setCurvePoints, lambda: self.computeCurve(self.commitOnChange)])

        OWGUI.checkBox(box, self, 'commitOnChange', 'Apply setting on any change')
        self.commitBtn = OWGUI.button(box, self, "Apply Setting", callback=self.computeCurve, disabled=1)

        # table widget
        self.table = OWGUI.table(self.mainArea, selectionMode=QTableWidget.NoSelection)
                
        self.resize(500,200)
Ejemplo n.º 39
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "FeatureConstructor",wantMainArea = 0)
        self.inputs = [("Examples", ExampleTable, self.setData)]
        self.outputs = [("Examples", ExampleTable)]

        self.newName = "NEW_CLASS"
        self.value = "?"
        self.values = "[]"
        self.data = None
        
        box = OWGUI.widgetBox(self.controlArea,"Add discrete class")
        newNameBox = OWGUI.lineEdit(box, self, "newName", "Class name: ", labelWidth=70, orientation="horizontal", tooltip="Name of the new Class attribute to be added")
        valueBox = OWGUI.lineEdit(box, self, "value", "Value: ", labelWidth=70, orientation="horizontal", tooltip="Class value to be assigned to each example")
        #valuesBox = OWGUI.lineEdit(box, self, "values", "Class values: ", labelWidth=70, orientation="horizontal", tooltip='Optional, list of possible values of new discrete class attribute ex: ["POS", "NEG"]')
 
        self.BT = OWGUI.button(self.controlArea, self, "&Apply", callback = self.apply, disabled=0)
        infoBox = OWGUI.widgetBox(self,"Info")
        OWGUI.widgetLabel(infoBox, 'Adds a new discrete response variable\nto the data and gives all examples the same value.')


        self.adjustSize()
Ejemplo n.º 40
0
    def __init__(self,
                 parent=None,
                 signalManager=None,
                 name='AttributeDistance'):
        self.callbackDeposit = []  # deposit for OWGUI callback functions
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          name,
                          wantMainArea=0,
                          resizingEnabled=0)

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

        self.data = None

        self.classInteractions = 0
        self.loadSettings()
        rb = OWGUI.radioButtonsInBox(self.controlArea,
                                     self,
                                     "classInteractions", [],
                                     "Distance",
                                     callback=self.toggleClass)
        OWGUI.widgetLabel(
            rb,
            "Measures on discrete attributes\n   (continuous attributes are discretized into five intervals)"
        )
        for b in self.discMeasures:
            OWGUI.appendRadioButton(rb, self, "classInteractions", b)

        OWGUI.widgetLabel(
            rb, "\n" +
            "Measures on continuous attributes\n   (discrete attributes are treated as ordinal)"
        )
        for b in self.contMeasures:
            OWGUI.appendRadioButton(rb, self, "classInteractions", b)

        OWGUI.rubber(self.controlArea)
        self.resize(215, 50)
Ejemplo n.º 41
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.º 42
0
    def __init__(self, parent=None, signalManager = None, name='AttributeDistance'):
        self.callbackDeposit = [] # deposit for OWGUI callback functions
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

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

        self.data = None

        self.classInteractions = 0
        self.loadSettings()
        rb = OWGUI.radioButtonsInBox(self.controlArea, self, "classInteractions", [], "Distance", callback=self.toggleClass)
        OWGUI.widgetLabel(rb, "Measures on discrete attributes\n   (continuous attributes are discretized into five intervals)")
        for b in self.discMeasures:
            OWGUI.appendRadioButton(rb, self, "classInteractions", b)
        
        OWGUI.widgetLabel(rb, "\n"+"Measures on continuous attributes\n   (discrete attributes are treated as ordinal)")
        for b in self.contMeasures:
            OWGUI.appendRadioButton(rb, self, "classInteractions", b)
            
        OWGUI.rubber(self.controlArea)
        self.resize(215,50)
Ejemplo n.º 43
0
    def defineGUI(self):

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

        info = OWGUI.widgetBox(self.controlArea, "Constituting Consensus Learners", addSpace = True, orientation=0)
        self.learnerInfo = OWGUI.widgetLabel(info, '')

        OWGUI.lineEdit(self.controlArea, self, 'expr', box='Expression', \
                       tooltip='Expression used to combine the constituting models.\n \
Example Classification; \nSVM == POS or PLS == POS or RF == POS -> POS, -> NEG\n \
This expression will predict POS if any of the 3 classifiers predict POS.\n \
Example Regression; \n(SVM+RF+ANN)/3.0\n \
This expression will give an average prediction.\n \
Please note the the denominator needs to be a float!')

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

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

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

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

        self.applySettings()
        self.adjustSize()
Ejemplo n.º 44
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Concatenate", wantMainArea=0)
        self.inputs = [("Primary Data", orange.ExampleTable, self.setData), ("Additional Data", orange.ExampleTable, self.setMoreData, Multiple)]
        self.outputs = [("Data", ExampleTable)]

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

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

        OWGUI.separator(self.controlArea)
        box = OWGUI.widgetBox(self.controlArea, "Data source IDs", addSpace=True)
        cb = OWGUI.checkBox(box, self, "dataSourceSelected", "Append data source IDs")
        self.classificationBox = ib = OWGUI.indentedBox(box, sep=OWGUI.checkButtonOffsetHint(cb))
        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.button(self.controlArea, self, "Apply Changes", callback = self.apply, default=True)
        
        OWGUI.rubber(self.controlArea)

        self.adjustSize()
        
        self.dataReport = None
Ejemplo n.º 45
0
    def __init__(self, parent=None, signalManager = None, title = "Calibrated Classifier"):
        OWWidget.__init__(self, parent, signalManager, title)

        self.inputs = [("Data", ExampleTable, self.setData), ("Base Learner", orange.Learner, self.setBaseLearner)]
        self.outputs = [("Learner", orange.Learner),("Classifier", orange.Classifier)]

        # Settings
        self.name = 'Calibrated Learner'
        self.optimalThreshold = 0
        self.threshold = self.accuracy = 50
        self.loadSettings()

        self.learner = None
        self.baseLearner = None
        self.data = 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.wbThreshold = OWGUI.widgetBox(self.controlArea, "Threshold", addSpace=True)
        self.cbOptimal = OWGUI.checkBox(self.wbThreshold, self, "optimalThreshold",
                                        "Use optimal threshold",
                                        callback=self.setThreshold)
        
        self.spThreshold = OWGUI.spin(self.wbThreshold, self, "threshold", 1, 99, step=5,
                                      label = "Threshold",
                                      orientation = "horizontal",
                                      callback = self.setThreshold)
        
        self.lbNotice = OWGUI.widgetLabel(self.wbThreshold, "Notice: If the widget is connected to a widget that takes a Learner, not a Classifier (eg 'Test Learners'), the automatically computed threshold can differ from the above.")
        self.lbNotice.setWordWrap(True)
         
        self.cbOptimal.disables = [self.lbNotice]
        self.cbOptimal.makeConsistent()
        self.spThreshold.setDisabled(self.optimalThreshold)
        
        OWGUI.rubber(self.controlArea)
        
        OWGUI.button(self.controlArea, self, "&Apply Setting",
                     callback = self.btApplyCallback,
                     disabled=0)

        self.btSave = OWGUI.button(self.controlArea, self, "&Save Graph", callback = self.saveToFile, disabled=1)

        self.graph = ThresholdGraph()
        self.mainArea.layout().addWidget(self.graph)

        self.resize(700, 330)
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self,parent,signalManager,"FeatureSelection")
        self.inputs = [("Example Table", ExampleTable, self.dataset)]
        self.outputs = [("Example Table", ExampleTable)]

        warnings.filterwarnings("ignore", "", orange.AttributeWarning)
        
        self.data = None
        self.chosenMeasure = [0]
        self.measures = ['Term frequency', 'Random', 'Term document frequency', 'Word frequency', 'Number of features']
        self.chosenOp = [0]
        self.measureDict = {0: 'TF', 1: 'RAND', 2: 'TDF', 3: 'WF', 4: 'NF'}
        self.operators = ['MIN', 'MAX']
        self.tmpData = None
        self.perc = 1
        self.threshold = 90
        self.selections = []

        #GUI
        #ca=QFrame(self.controlArea)
        #gl=QGridLayout(ca)
        selectionbox = OWGUI.widgetBox(self.controlArea, "Feature selection", "horizontal") #OWGUI.QHGroupBox('Feature selection', self.controlArea)

        OWGUI.listBox(selectionbox, self, 'chosenMeasure', 'measures', box = 'Select measure', callback = self.selectionChanged)
        OWGUI.listBox(selectionbox, self, 'chosenOp', 'operators', box = 'Select operator', callback = self.selectionChanged)

        boxAttrStat = OWGUI.widgetBox(self.controlArea, "Statistics for features") #QVGroupBox("Statistics for features", self.controlArea)
        self.lblFeatNo = OWGUI.widgetLabel(boxAttrStat, "No. of features: ") #QLabel("No. of features: ", boxAttrStat)
        self.lblMin = OWGUI.widgetLabel(boxAttrStat, "Min: ") #QLabel("Min: ", boxAttrStat)
        self.lblAvg = OWGUI.widgetLabel(boxAttrStat, "Avg: ") #QLabel("Avg: ", boxAttrStat)
        self.lblMax = OWGUI.widgetLabel(boxAttrStat, "Max: ") #QLabel("Max: ", boxAttrStat)

        boxDocStat = OWGUI.widgetBox(self.controlArea, "Statistics for documents") #QVGroupBox("Statistics for documents", self.controlArea)
        self.lblDocNo = OWGUI.widgetLabel(boxDocStat, "No. of documents: ") #QLabel("No. of documents: ", boxDocStat)
        self.lblDocAvg = OWGUI.widgetLabel(boxDocStat, "Avg: ") #QLabel("Avg: ", boxDocStat)
        self.lblDocMax = OWGUI.widgetLabel(boxDocStat, "Max: ") #QLabel("Max: ", boxDocStat)
        self.lblDocMin = OWGUI.widgetLabel(boxDocStat, "Min: ") #QLabel("Min: ", boxDocStat)

        optionBox = OWGUI.widgetBox(selectionbox, "") #OWGUI.QVGroupBox('', selectionbox)        

        self.applyButton = OWGUI.button(optionBox, self, "Apply", self.apply)
        self.applyButton.setDisabled(1)
        OWGUI.checkBox(optionBox, self, "perc", "percentage", callback = self.selectionChanged)
        #OWGUI.spin(optionBox, self, "threshold", 0, 10000, label="Threshold:", callback = None)
        OWGUI.lineEdit(optionBox, self, "threshold", orientation="horizontal", valueType=float, box="Threshold", callback = self.selectionChanged)
        OWGUI.rubber(self.controlArea)
        self.controlArea.adjustSize()
Ejemplo n.º 47
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "CinfonyDesc",wantMainArea = 0)

        self.data = None
        #self.getCinfonyDescObj = getCinfonyDesc.CinfonyDescGetter()
       
        self.inputs = [("Examples", ExampleTable, self.setData)]
        self.outputs = [("Examples", ExampleTable)]

        # GUI definition
        self.Descriptors = widgetSelector(self.controlArea, "Descriptors",applyText = "Retrieve", callbackOnApply=self.__retrieve)
        box = OWGUI.widgetBox(self.controlArea, "Info")
        self.info = OWGUI.widgetLabel(box, '')

        self.__initListBox()
Ejemplo n.º 48
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "FeatureConstructor")
        #To enable the use of primary table, uncomment the next line  and comment the following one
        #self.inputs = [("Primary Table", dataUtilities.DataTable, self.setData), ("Additional Tables", dataUtilities.DataTable, self.setMoreData, Multiple)]
        self.inputs = [("Tables", orange.ExampleTable, self.setMoreData,
                        Multiple)]

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

        self.mergeAttributes = 0
        self.primary = None
        self.additional = {}

        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.")

        infoBox = OWGUI.widgetBox(self, "Concatenate status")
        self.infoStatus = OWGUI.widgetLabel(infoBox, '')

        self.viewBT = OWGUI.button(self.controlArea,
                                   self,
                                   "&View converted incompatible attributes",
                                   callback=self.viewIncompatible,
                                   disabled=1)

        self.adjustSize()
Ejemplo n.º 49
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "FeatureConstructor",wantMainArea = 0)
        self.inputs = [("Examples", ExampleTable, self.setData)]
        self.outputs = [("Examples", ExampleTable)]

        self.newName = "CLASS"
        self.data = None
        
        box = OWGUI.widgetBox(self.controlArea, "Rename class")
        newNameBox = OWGUI.lineEdit(box, self, "newName", "New Class name: ", labelWidth=100, orientation="horizontal", tooltip="New name for the Class attribute")
 
        self.BT = OWGUI.button(self.controlArea, self, "&Apply", callback = self.apply, disabled=0)
        infoBox = OWGUI.widgetBox(self,"Info")
        self.info = OWGUI.widgetLabel(infoBox, 'Renames the class attribute of the data.')


        self.adjustSize()
Ejemplo n.º 50
0
    def __init__(self, parent=None, signalManager=None,
                 title="Translate Domain"):
        OWWidget.__init__(self, parent, signalManager, title,
                          wantMainArea=False)

        self.inputs = [("Target Domain", Orange.data.Table, self.set_target),
                       ("Input Data", Orange.data.Table, self.set_input)]

        self.outputs = [("Translated Data", Orange.data.Table)]

        box = OWGUI.widgetBox(self.controlArea, "Info")
        self.info = OWGUI.widgetLabel(box, "No target domain\nNo input data")

        OWGUI.rubber(self.controlArea)

        self.target = None
        self.input_data = None
Ejemplo n.º 51
0
    def __init__(self, parent=None, signalManager = None, name='Loaded model'):
        OWWidget.__init__(self, parent, signalManager, name)

        self.resize(400,200)

        # Define the input and output channels
        self.inputs = []
        self.outputs = [("Classifier", orange.Classifier)]
        self.name = name
        self.modelFile = os.getcwd()
        self.modelType = None
        
        #GUI

        OWGUI.lineEdit(self.controlArea, self, 'name', box='Classifier Name', \
                       tooltip='Name to be used by other widgets to identify your classifier.<br>This should be a unique name!')


        # Define the model type. SVM, SVM_Jakulin or ANN.
        #self.kernelBox=b=OWGUI.widgetBox(self.controlArea, "Select the model type you wish to load")
        #self.kernelradio = OWGUI.radioButtonsInBox(b, self, "modelType", btnLabels=["SVM", \
        #                   "ANN                                                  ", \
        #                   "Random Forest","PLS"])

        # Get location of model file
        boxFile = OWGUI.widgetBox(self.controlArea, "Model file location", addSpace = True, orientation=0)
        L1 = OWGUI.lineEdit(boxFile, self, "modelFile", labelWidth=80,  orientation = "horizontal", tooltip = "Enter full path to the model file location")
        L1.setMinimumWidth(200)
        button = OWGUI.button(boxFile, self, '...', callback = self.browse, disabled=0,tooltip = "Choose the dir where to save. After chosen, add a name for the model file!")
        button.setMaximumWidth(25)

        # Load the model
        OWGUI.button(self.controlArea, self,"&Load model from file", callback=self.loadModel)

        box = OWGUI.widgetBox(self.controlArea, "Info")
        self.info = OWGUI.widgetLabel(box, 'No model loaded.')


        self.adjustSize()
Ejemplo n.º 52
0
    def __init__(self, master=None, parent=None, label=None, color=None):
        QWidget.__init__(self, master)

        self.parent = parent
        self.master = master

        if self.parent and self.parent.layout():
            self.parent.layout().addWidget(self)

        self.setLayout(QHBoxLayout())
        self.layout().setMargin(0)
        self.icon = QFrame(self)
        self.icon.setFixedSize(colorButtonSize, colorButtonSize)
        self.icon.setAutoFillBackground(1)
        self.icon.setFrameStyle(QFrame.StyledPanel + QFrame.Sunken)
        self.layout().addWidget(self.icon)

        if label != None:
            self.label = OWGUI.widgetLabel(self, label)
            self.layout().addWidget(self.label)

        if color != None:
            self.setColor(color)