Ejemplo n.º 1
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.º 2
0
    def __init__(self,
                 parent=None,
                 signalManager=None,
                 name="Save Association Rules"):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          name,
                          wantMainArea=False)

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

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

        self.loadSettings()

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

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

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

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

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

        self.save_button.setEnabled(False)

        OWGUI.rubber(self.controlArea)

        self.resize(200, 100)

        self.rules = None
Ejemplo n.º 3
0
    def __init__(self, parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, 'Majority', wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

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

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

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

        OWGUI.separator(self.controlArea)

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

        self.learner = orange.MajorityLearner()
        self.setLearner()
        self.resize(100,100)
    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.º 5
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.º 6
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.º 7
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()
    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, 'Majority', wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

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

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

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

        OWGUI.separator(self.controlArea)

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

        self.learner = orange.MajorityLearner()
        self.setLearner()
        self.resize(100,100)
Ejemplo n.º 10
0
    def __init__(self, parent=None, signalManager=None):
        self.callbackDeposit = []  # deposit for OWGUI callback functions
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          "Matrix Transformation",
                          wantMainArea=0,
                          resizingEnabled=0)
        self.inputs = [("Matrix", orange.SymMatrix, self.setMatrix, Default)]
        self.outputs = [("Matrix", orange.SymMatrix)]
        self.matrix = None
        self.normalizeMethod = self.invertMethod = 0
        self.loadSettings()
        ribg = OWGUI.radioButtonsInBox(self.controlArea,
                                       self,
                                       "normalizeMethod",
                                       self.normalizeMethods,
                                       "Normalization",
                                       callback=self.setNormalizeMode,
                                       addSpace=True)
        ribg = OWGUI.radioButtonsInBox(self.controlArea,
                                       self,
                                       "invertMethod",
                                       self.inversionMethods,
                                       "Inversion",
                                       callback=self.setInvertMode)

        OWGUI.rubber(self.controlArea)

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

        self.browseButton.setIcon(self.style().standardIcon(QStyle.SP_DirOpenIcon))
        self.browseButton.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
        
        OWGUI.rubber(self.controlArea)
        
        self.resize(200, 50)
        
        if self.filename_history:
            self.load_and_send()
Ejemplo n.º 12
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.º 13
0
    def __init__(self, parent=None):
        BaseEditor.__init__(self, parent)
        self.discInd = 0
        self.numberOfIntervals = 3
        #        box = OWGUI.widgetBox(self, "Discretize")
        rb = OWGUI.radioButtonsInBox(self,
                                     self,
                                     "discInd", [],
                                     box="Discretize",
                                     callback=self.onChange)
        for label, _, _ in self.DISCRETIZERS[:-1]:
            OWGUI.appendRadioButton(rb, self, "discInd", label)
        self.sliderBox = OWGUI.widgetBox(
            OWGUI.indentedBox(rb,
                              sep=OWGUI.checkButtonOffsetHint(rb.buttons[-1])),
            "Num. of intervals (for equal width/frequency)")
        OWGUI.hSlider(self.sliderBox,
                      self,
                      "numberOfIntervals",
                      callback=self.onChange,
                      minValue=1)
        OWGUI.appendRadioButton(rb, self, "discInd", self.DISCRETIZERS[-1][0])
        OWGUI.rubber(rb)

        self.updateSliderBox()
Ejemplo n.º 14
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.º 15
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.º 16
0
    def __init__(self):
        QWidget.__init__(self)
        self.setWindowTitle(_("Report"))
        self.setWindowIcon(
            QIcon(os.path.join(redREnviron.widgetDir, "icons/Unknown.png")))
        global report
        if not self.checkExtLibrary():
            report = None
            return

        report = self

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

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

        self.tempdir = tempfile.mkdtemp("", "orange-report-")
        hbox = OWGUI.widgetBox(self, orientation=0)
        self.reportButton = OWGUI.button(hbox,
                                         self,
                                         "&Save",
                                         self.saveReport,
                                         width=120)
        OWGUI.rubber(hbox)
Ejemplo n.º 17
0
    def __init__(self,
                 parent=None,
                 signalManager=None,
                 title="Combine Matrices"):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          title,
                          wantMainArea=False)

        self.inputs = [("Matrices", Orange.misc.SymMatrix, self.set_matrix,
                        Multiple)]
        self.outputs = [("Combined Matrix", Orange.misc.SymMatrix, Multiple)]

        self.selected_method = 0

        box = OWGUI.widgetBox(self.controlArea, "Method")
        OWGUI.comboBox(box,
                       self,
                       "selected_method",
                       items=[t[0] for t in self.METHODS],
                       tooltip="Select the method for combining the matrices",
                       callback=self.method_changed)

        OWGUI.rubber(self.controlArea)
        self.matrices = {}
        self.resize(150, 30)
Ejemplo n.º 18
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()
Ejemplo n.º 19
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.º 20
0
    def __init__(self, parent=None, signalManager = None, name='Binary Relevance'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

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

        # Settings
        self.name = 'Binary Relevance'
        self.base_learner = Orange.core.BayesLearner;
        
        self.loadSettings()

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

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

        OWGUI.separator(self.controlArea)

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

        self.resize(100,250)
Ejemplo n.º 21
0
    def __init__(self, parent=None, signalManager=None, 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.º 22
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.º 23
0
 def __init__(self, parent=None, signalManager=None, name="Ensemble"):
     OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False)
     
     self.inputs = [("Learner", orange.Learner, self.setLearner), ("Data", ExampleTable, self.setData)]
     self.outputs = [("Learner", orange.Learner), ("Classifier", orange.Classifier)]
     
     self.method = 0
     self.t = 10
     
     self.loadSettings()
     
     box = OWGUI.radioButtonsInBox(self.controlArea, self, "method",
                                   [name for name, _ in self.METHODS], 
                                   box="Ensemble",
                                   callback=self.onChange)
     
     i_box = OWGUI.indentedBox(box, sep=OWGUI.checkButtonOffsetHint(box.buttons[0]))
     
     OWGUI.spin(i_box, self, "t", min=1, max=100, step=1, label="Number of created classifiers:")
     OWGUI.rubber(self.controlArea)
     OWGUI.button(self.controlArea, self, "&Apply", callback=self.commit)
     
     self.data = None
     self.learner = None
     
     self.resize(100, 100)
Ejemplo n.º 24
0
    def __init__(self,
                 parent=None,
                 signalManager=None,
                 name='Distance Matrix Filter'):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          name,
                          wantMainArea=0,
                          resizingEnabled=0)

        self.inputs = [("Distance Matrix", orange.SymMatrix, self.setSymMatrix,
                        Default),
                       ("Example Subset", ExampleTable, self.setExampleSubset)]
        self.outputs = [("Distance Matrix", orange.SymMatrix)]

        self.matrix = None
        self.subset = None
        self.subsetAttr = 0
        self.icons = self.createAttributeIconDict()

        subsetBox = OWGUI.widgetBox(self.controlArea,
                                    box='Filter by Subset',
                                    orientation='vertical')

        self.subsetAttrCombo = OWGUI.comboBox(subsetBox,
                                              self,
                                              "subsetAttr",
                                              callback=self.filter)
        self.subsetAttrCombo.addItem("(none)")

        OWGUI.rubber(self.controlArea)

        self.resize(200, 50)
Ejemplo n.º 25
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.º 26
0
    def __init__(self, parent=None, signalManager = None, name='Label Powerset'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

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

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

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

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

        OWGUI.separator(self.controlArea)

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

        self.resize(100,250)
Ejemplo n.º 27
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.º 28
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.º 29
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.º 30
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.º 31
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.º 32
0
    def __init__(self, parent=None, signalManager = None, name='Classification Tree'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

        self.inputs = [("Examples", ExampleTable, self.setData), ("Preprocess", PreprocessedLearner, self.setPreprocessor)]
        self.outputs = [("Learner", orange.TreeLearner),("Classification Tree", orange.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)
        
        OWGUI.rubber(self.controlArea)
        self.resize(200,200)
Ejemplo n.º 33
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "Regression Tree", wantMainArea = 0, resizingEnabled = 0)
        self.Name="Regression Tree"
        self.MinInstCheck=1
        self.MinInstVal=5
        self.MinNodeCheck=1
        self.MinNodeVal=10
        self.MaxMajCheck=1
        self.MaxMajVal=70
        self.PostMaj=1
        self.PostMPCheck=1
        self.PostMPVal=5
        self.Bin=1
        self.loadSettings()

        self.data=None
        self.preprocessor = None

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

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

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

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

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

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

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

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

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

        OWGUI.button(self.controlArea, self, "&Apply settings", callback=self.setLearner, default=True)
        
        OWGUI.rubber(self.controlArea)
        self.setLearner()
        self.resize(100,100)
Ejemplo n.º 34
0
    def __init__(self, parent=None, signalManager=None, name='BR-kNN'):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          name,
                          wantMainArea=0,
                          resizingEnabled=0)

        self.callbackDeposit = []

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

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

        self.loadSettings()

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

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

        OWGUI.separator(self.controlArea)

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

        OWGUI.separator(self.controlArea)

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

        OWGUI.rubber(self.controlArea)

        self.resize(100, 250)
Ejemplo n.º 35
0
    def __init__(self, parent=None):
        BaseEditor.__init__(self, parent)
        self.contInd = 0

        b = OWGUI.radioButtonsInBox(self,
                                    self,
                                    "contInd",
                                    [name for name, _ in self.CONTINUIZERS],
                                    box="Continuize",
                                    callback=self.onChange)
        OWGUI.rubber(b)
Ejemplo n.º 36
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.º 37
0
    def __init__(self, parent):
        BaseEditor.__init__(self, parent)

        self.methodInd = 0
        b = OWGUI.radioButtonsInBox(self,
                                    self,
                                    "methodInd",
                                    [label for label, _ in self.IMPUTERS],
                                    box="Impute",
                                    callback=self.onChange)
        OWGUI.rubber(b)
Ejemplo n.º 38
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          "Save",
                          wantMainArea=0,
                          resizingEnabled=0)

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

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

        #        vb = OWGUI.widgetBox(self.controlArea)

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

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

        OWGUI.rubber(self.controlArea)

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

        if self.selectedFileName != "":
            if os.path.exists(self.selectedFileName):
                self.openFile(self.selectedFileName)
            else:
                self.selectedFileName = ""
Ejemplo n.º 39
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self,
                          parent,
                          signalManager,
                          'ExampleDistance',
                          wantMainArea=0,
                          resizingEnabled=0)

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

        self.Metrics = 0
        self.Label = ""
        self.loadSettings()
        self.data = None
        self.matrix = None

        self.metrics = [
            ("Euclidean", orange.ExamplesDistanceConstructor_Euclidean),
            ("Pearson Correlation",
             orngClustering.ExamplesDistanceConstructor_PearsonR),
            ("Spearman Rank Correlation",
             orngClustering.ExamplesDistanceConstructor_SpearmanR),
            ("Manhattan", orange.ExamplesDistanceConstructor_Manhattan),
            ("Hamming", orange.ExamplesDistanceConstructor_Hamming),
            ("Relief", orange.ExamplesDistanceConstructor_Relief),
        ]

        cb = OWGUI.comboBox(
            self.controlArea,
            self,
            "Metrics",
            box="Distance Metrics",
            items=[x[0] for x in self.metrics],
            tooltip=
            "Choose metrics to measure pairwise distance between examples.",
            callback=self.computeMatrix,
            valueType=str)
        cb.setMinimumWidth(170)

        OWGUI.separator(self.controlArea)
        self.labelCombo = OWGUI.comboBox(
            self.controlArea,
            self,
            "Label",
            box="Example Label",
            items=[],
            tooltip="Attribute used for example labels",
            callback=self.setLabel,
            sendSelectedValue=1)

        self.labelCombo.setDisabled(1)

        OWGUI.rubber(self.controlArea)
    def __init__(self, parent=None, signalManager = None, name='Outlier'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.inputs = [("Data", ExampleTable, self.cdata),("Distances", orange.SymMatrix, self.cdistance)]
        self.outputs = [("Outliers", ExampleTable), ("Inliers", ExampleTable), ("Data with z-score", ExampleTable)]
               
        # Settings
        self.zscore = '4.0'
        self.k = 1
        self.metric = 0
        self.loadSettings()
        
        self.haveInput = 0
        self.data = None                    # input data set
        self.dataInput = None
        self.distanceMatrix = None
        
        kernelSizeValid = QDoubleValidator(self.controlArea)


        self.metrics = [("Euclidean", orange.ExamplesDistanceConstructor_Euclidean),
                        ("Manhattan", orange.ExamplesDistanceConstructor_Manhattan),
                        ("Hamming", orange.ExamplesDistanceConstructor_Hamming),
                        ("Relief", orange.ExamplesDistanceConstructor_Relief)]

        self.ks = [("All",0), ("1", 1), ("2",2), ("3",3), ("5",5), ("10",10), ("15",15)]
        items = [x[0] for x in self.metrics]
        itemsk = [x[0] for x in self.ks]
        
        OWGUI.comboBox(self.controlArea, self, "metric", box="Distance Metrics", items=items,
                       tooltip="Metrics to measure pairwise distance between data instances.",
                       callback=self.dataChange)

        OWGUI.separator(self.controlArea)
        OWGUI.comboBox(self.controlArea, self, "k", box="Nearest Neighbours", items=itemsk,
                       tooltip="Neighbours considered when computing the distance.",
                       callback=self.applySettings)

        OWGUI.separator(self.controlArea)
        box = OWGUI.widgetBox(self.controlArea, "Outliers")
        OWGUI.lineEdit(box, self, 'zscore',
                       label = 'Outlier Z:', labelWidth=80,
                       orientation='horizontal', # box=None,
                       validator = kernelSizeValid,
                       tooltip="Minimum Z-score of an outlier.",
                       callback=self.applySettings)

        OWGUI.rubber(self.controlArea)
        
        self.loadSettings()
      
        self.resize(100,100)
        self.applySettings()
    def __init__(self, parent=None, signalManager=None, name="Molecule Match"):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False)

        self.inputs = [("Molecules", ExampleTable, self.SetMoleculeTable)]
        self.outputs = [("Selected molecules", ExampleTable), ("All molecules", ExampleTable)]

        self.fragment = ""
        self.recentFragments = []
        self.comboSelection = 0
        self.smilesAttr = 0
        self.smilesAttrList = []
        self.data = None
        self.loadSettings()

        ##GUI
        self.lineEdit = OWGUI.lineEdit(
            self.controlArea,
            self,
            "fragment",
            box="Pattern",
            tooltip="A SMARTS pattern to filter the examples with.",
            callback=self.LineEditSelect,
        )

        OWGUI.separator(self.controlArea)

        self.fragmentComboBox = OWGUI.comboBox(
            self.controlArea,
            self,
            "comboSelection",
            "Recent Patterns",
            tooltip="Select a recently used pattern.",
            items=self.recentFragments,
            callback=self.RecentSelect,
        )

        OWGUI.separator(self.controlArea)

        self.smilesAttrCombo = OWGUI.comboBox(
            self.controlArea,
            self,
            "smilesAttr",
            "Examples SMILES attribute",
            tooltip="Select the attribute in the input example \
                                              table that stores the SMILES molecule description",
            callback=self.Process,
        )

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

        if not HAVE_PYBEL:
            self.error(10, "This widget requires pybel module (part of openbabel python extension).")
Ejemplo n.º 42
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "FeatureConstructor")

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

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

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

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

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

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

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

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

        self.adjustSize()
Ejemplo n.º 43
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'PurgeDomain', wantMainArea=False)
        self.settingsList=["removeValues", "removeAttributes", "removeClassAttribute", "removeClasses", "autoSend", "sortValues", "sortClasses"]

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

        self.data = None

        self.preRemoveValues = self.removeValues = 1
        self.removeAttributes = 1
        self.removeClassAttribute = 1
        self.preRemoveClasses = self.removeClasses = 1
        self.autoSend = 1
        self.dataChanged = False

        self.sortValues = self.sortClasses = True

        self.loadSettings()

        self.removedAttrs = self.reducedAttrs = self.resortedAttrs = self.classAttr = "-"

        boxAt = OWGUI.widgetBox(self.controlArea, "Attributes", addSpace=True)
        OWGUI.checkBox(boxAt, self, 'sortValues', 'Sort attribute values', callback = self.optionsChanged)
        rua = OWGUI.checkBox(boxAt, self, "removeAttributes", "Remove attributes with less than two values", callback = self.removeAttributesChanged)

        ruv = OWGUI.checkBox(OWGUI.indentedBox(boxAt, sep=OWGUI.checkButtonOffsetHint(rua)), self, "removeValues", "Remove unused attribute values", callback = self.optionsChanged)
        rua.disables = [ruv]
        rua.makeConsistent()


        boxAt = OWGUI.widgetBox(self.controlArea, "Classes", addSpace=True)
        OWGUI.checkBox(boxAt, self, 'sortClasses', 'Sort classes', callback = self.optionsChanged)
        rua = OWGUI.checkBox(boxAt, self, "removeClassAttribute", "Remove class attribute if there are less than two classes", callback = self.removeClassesChanged)
        ruv = OWGUI.checkBox(OWGUI.indentedBox(boxAt, sep=OWGUI.checkButtonOffsetHint(rua)), self, "removeClasses", "Remove unused class values", callback = self.optionsChanged)
        rua.disables = [ruv]
        rua.makeConsistent()


        box3 = OWGUI.widgetBox(self.controlArea, 'Statistics', addSpace=True)
        OWGUI.label(box3, self, "Removed attributes: %(removedAttrs)s")
        OWGUI.label(box3, self, "Reduced attributes: %(reducedAttrs)s")
        OWGUI.label(box3, self, "Resorted attributes: %(resortedAttrs)s")
        OWGUI.label(box3, self, "Class attribute: %(classAttr)s")
        
        box2 = OWGUI.widgetBox(self.controlArea, "Send")
        btSend = OWGUI.button(box2, self, "Send data", callback = self.process, default=True)
        cbAutoSend = OWGUI.checkBox(box2, self, "autoSend", "Send automatically")

        OWGUI.setStopper(self, btSend, cbAutoSend, "dataChanged", self.process)
        
        OWGUI.rubber(self.controlArea)
    def __init__ (self, parent=None, signalManager = None, name = "Logistic regression"):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

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

        from orngTree import TreeLearner
        imputeByModel = orange.ImputerConstructor_model()
        imputeByModel.learnerDiscrete = TreeLearner(measure = "infoGain", minSubset = 50)
        imputeByModel.learnerContinuous = TreeLearner(measure = "retis", minSubset = 50)
        self.imputationMethods = [imputeByModel, orange.ImputerConstructor_average(), orange.ImputerConstructor_minimal(), orange.ImputerConstructor_maximal(), None]
        self.imputationMethodsStr = ["Classification/Regression trees", "Average values", "Minimal value", "Maximal value", "None (skip examples)"]

        self.name = "Logistic regression"
        self.univariate = 0
        self.stepwiseLR = 0
        self.addCrit = 10
        self.removeCrit = 10
        self.numAttr = 10
        self.limitNumAttr = False
        self.zeroPoint = 0
        self.imputation = 1

        self.data = None
        self.preprocessor = None

        self.loadSettings()

        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)

        box = OWGUI.widgetBox(self.controlArea, "Attribute selection")

        stepwiseCb = OWGUI.checkBox(box, self, "stepwiseLR", "Stepwise attribute selection")
        ibox = OWGUI.indentedBox(box, sep=OWGUI.checkButtonOffsetHint(stepwiseCb))
        addCritSpin = OWGUI.spin(ibox, self, "addCrit", 1, 50, label="Add threshold [%]", labelWidth=155, tooltip="Requested significance for adding an attribute")
        remCritSpin = OWGUI.spin(ibox, self, "removeCrit", 1, 50, label="Remove threshold [%]", labelWidth=155, tooltip="Requested significance for removing an attribute")
        limitAttSpin = OWGUI.checkWithSpin(ibox, self, "Limit number of attributes to ", 1, 100, "limitNumAttr", "numAttr", step=1, labelWidth=155, tooltip="Maximum number of attributes. Algorithm stops when it selects specified number of attributes.")
        stepwiseCb.disables += [addCritSpin, remCritSpin, limitAttSpin]
        stepwiseCb.makeConsistent()
        
        OWGUI.separator(self.controlArea)

        self.imputationCombo = OWGUI.comboBox(self.controlArea, self, "imputation", box="Imputation of unknown values", items=self.imputationMethodsStr)
        OWGUI.separator(self.controlArea)

        applyButton = OWGUI.button(self.controlArea, self, "&Apply", callback=self.applyLearner, default=True)

        OWGUI.rubber(self.controlArea)
        #self.adjustSize()

        self.applyLearner()
Ejemplo n.º 45
0
    def __init__(self, parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Predictions")

        self.callbackDeposit = []
        self.inputs = [("Examples", ExampleTable, self.setData), ("Predictors", orange.Classifier, self.setPredictor, Multiple)]
        self.outputs = [("Predictions", ExampleTable)]
        self.predictors = {}

        # saveble settings
        self.ShowAttributeMethod = 0
        self.classes = []
        self.selectedClasses = []
        self.loadSettings()
        self.datalabel = "N/A"
        self.predictorlabel = "N/A"
        self.tasklabel = "N/A"
        self.outvar = None # current output variable (set by the first predictor/data set send in)
        self.classifications = []
        self.rindx = None        
        self.data = None
        self.verbose = 0
        self.nVarImportance = 0

        # GUI - Options

        # Options - classification
        ibox = OWGUI.widgetBox(self.controlArea, "Info")
        OWGUI.label(ibox, self, "Data: %(datalabel)s")
        OWGUI.label(ibox, self, "Predictors: %(predictorlabel)s")
        OWGUI.label(ibox, self, "Task: %(tasklabel)s")
        OWGUI.separator(ibox)
        OWGUI.label(ibox, self, "Predictions can be viewed with the 'Data Table'\nand saved with the 'Save' widget!")

        OWGUI.separator(self.controlArea)
        
        self.copt = OWGUI.widgetBox(self.controlArea,"Probabilities (classification)")
        self.copt.setDisabled(1)

        self.lbcls = OWGUI.listBox(self.copt, self, "selectedClasses", "classes",
                                   selectionMode=QListWidget.MultiSelection)
        self.lbcls.setFixedHeight(50)
        OWGUI.separator(self.controlArea)
        self.VarImportanceBox = OWGUI.doubleSpin(self.controlArea, self, "nVarImportance", 0,9999999,1, label="Variable importance",  orientation="horizontal", tooltip="The number of variables to report for each prediction.")

        OWGUI.checkBox(self.controlArea, self, 'verbose', 'Verbose', tooltip='Show detailed info while predicting. This will slow down the predictions process!') 
        OWGUI.separator(self.controlArea)
        self.outbox = OWGUI.widgetBox(self.controlArea,"Output")
        self.apply = OWGUI.button(self.outbox, self, "Apply", callback=self.sendpredictions)

        OWGUI.rubber(self.controlArea)
        self.adjustSize()
Ejemplo n.º 46
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.º 47
0
    def __init__(self, parent=None, signalManager = None, name='kNN'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

        self.callbackDeposit = []

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

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

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

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

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

        OWGUI.separator(self.controlArea)

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

        OWGUI.separator(self.controlArea)

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

        OWGUI.separator(self.controlArea)

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

        self.resize(100,250)
Ejemplo n.º 48
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Itemsets explorer")

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

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

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

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

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

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

        OWGUI.rubber(self.controlArea)

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

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

        self.itemsets= None
 def __init__(self, parent=None, signalManager = None):
     self.callbackDeposit = [] # deposit for OWGUI callback functions
     OWWidget.__init__(self, parent, signalManager, "Matrix Transformation", wantMainArea = 0, resizingEnabled = 0)
     self.inputs = [("Matrix", orange.SymMatrix, self.setMatrix, Default)]
     self.outputs = [("Matrix", orange.SymMatrix)]
     self.matrix = None
     self.normalizeMethod = self.invertMethod = 0
     self.loadSettings()
     ribg = OWGUI.radioButtonsInBox(self.controlArea, self, "normalizeMethod", self.normalizeMethods, "Normalization", callback = self.setNormalizeMode, addSpace=True)
     ribg = OWGUI.radioButtonsInBox(self.controlArea, self, "invertMethod", self.inversionMethods, "Inversion", callback = self.setInvertMode)
     
     OWGUI.rubber(self.controlArea)
     
     self.adjustSize()
Ejemplo n.º 50
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)
Ejemplo n.º 51
0
    def __init__ (self, parent=None, signalManager = None, name = "Logistic regression"):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0)

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

        self.regularizations = [ Orange.classification.logreg.LibLinearLogRegLearner.L2R_LR, Orange.classification.logreg.LibLinearLogRegLearner.L1R_LR ]
        self.regularizationsStr = [ "L2 (squared weights)", "L1 (absolute weights)" ]

        self.name = "Logistic regression"
        self.normalization = True
        self.C = 1.
        self.regularization = 0

        self.data = None
        self.preprocessor = None

        self.loadSettings()

        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)

        box = OWGUI.widgetBox(self.controlArea, "Regularization")

        self.regularizationCombo = OWGUI.comboBox(box, self, "regularization", items=self.regularizationsStr)

        cset = OWGUI.doubleSpin(box, self, "C", 0.01, 512.0, 0.1,
            decimals=2,
            addToLayout=True,
            label="Training error cost (C)",
            alignment=Qt.AlignRight,
            tooltip= "Weight of log-loss term (higher C means better fit on the training data)."),


        OWGUI.separator(self.controlArea)

        box = OWGUI.widgetBox(self.controlArea, "Preprocessing")

        OWGUI.checkBox(box, self, "normalization",
            label="Normalize data", 
            tooltip="Normalize data before learning.")

        OWGUI.separator(self.controlArea)

        applyButton = OWGUI.button(self.controlArea, self, "&Apply", callback=self.applyLearner, default=True)

        OWGUI.rubber(self.controlArea)
        #self.adjustSize()

        self.applyLearner()
Ejemplo n.º 52
0
    def __init__(self,parent = None, signalManager = None):
        OWClassificationTreeViewer.__init__(self, parent, signalManager, 'I&nteractive Tree Builder')
        self.inputs = [("Data", ExampleTable, self.setData),
                       ("Tree Learner", orange.Learner, self.setLearner)]
        
        self.outputs = [("Data", ExampleTable),
                        ("Classifier", Orange.classification.tree.TreeClassifier),
                        ("Tree Learner", orange.Learner)]

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

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

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

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

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

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

        OWGUI.rubber(buildTab)

        self.activateLoadedSettings()
    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()