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

        self.callbackDeposit = []

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

        self.useLazyEvaluation = armor.useLazyEvaluation

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

        self.data = None  # input data set

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

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

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

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

        self.callbackDeposit = []

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

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

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

        OWGUI.separator(self.controlArea)

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

        self.learner = orange.MajorityLearner()
        self.setLearner()
        self.resize(100,100)
Ejemplo n.º 3
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.º 4
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.º 5
0
    def __init__(self, parent=None):
        OWWidget.__init__(self, parent, title='Listbox')

        self.colors = ["Red", "Green", "Blue"]
        self.chosenColor = [2]
        self.numbers = ["One", "Two", "Three", "Four"]
        self.chosenNumbers = [0, 2, 3]

        OWGUI.listBox(self.controlArea,
                      self,
                      "chosenColor",
                      "colors",
                      box="Color",
                      callback=self.checkAll)
        OWGUI.listBox(self.controlArea,
                      self,
                      "chosenNumbers",
                      "numbers",
                      box="Number",
                      selectionMode=QListWidget.MultiSelection,
                      callback=self.checkAll)

        OWGUI.separator(self.controlArea)

        box = OWGUI.widgetBox(self.controlArea, "Debug info")
        OWGUI.label(box, self, "Color: %(chosenColor)s")
        OWGUI.label(box, self, "Numbers: %(chosenNumbers)s", labelWidth=100)

        self.setFixedSize(110, 280)
Ejemplo n.º 6
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'AttributeSampler')

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

        self.icons = self.createAttributeIconDict()

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

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

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

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

        self.resize(150,400)
Ejemplo n.º 7
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.º 8
0
    def __init__(self, parent=None, signalManager = None, name='filter'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

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

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

        self.data = None                    # input data set

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

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

        self.resize(100,150)
    def __init__(self, parent=None, signalManager = None, name='ExtractFeatures'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

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

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

        self.data = None                    # input data set

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

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

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

        self.callbackDeposit = []

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

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

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

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

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

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

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

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

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

        self.proportion = 50
        self.commitOnChange = 0
        self.loadSettings()

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

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

        self.resize(100, 50)
Ejemplo n.º 13
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.º 14
0
    def __init__(self, parent=None, signalManager = None, name='Histogram'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

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

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

        self.data = None                    # input data set

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

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

        self.resize(100,150)
Ejemplo n.º 15
0
    def __init__(self, parent=None):
        OWWidget.__init__(self, parent, title='X Learner')

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

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

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

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

        OWGUI.setStopper(self, applyButton, autoApplyCB, "settingsChanged", self.apply)        
        
        self.adjustSize()
Ejemplo n.º 16
0
    def __init__(self, parent=None, signalManager = None, name='filter'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

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

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

        self.data = None                    # input data set

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

        self.resize(100,150)
Ejemplo n.º 17
0
    def __init__(self, parent=None):
        OWWidget.__init__(self, parent, title='Listbox')

        self.attributes = []
        self.chosenAttribute = []
        self.values = []
        self.chosenValues = []

        OWGUI.listBox(self.controlArea,
                      self,
                      "chosenAttribute",
                      "attributes",
                      box="Attributes",
                      callback=self.setValues)
        OWGUI.separator(self.controlArea)
        OWGUI.listBox(self.controlArea,
                      self,
                      "chosenValues",
                      "values",
                      box="Values",
                      selectionMode=QListWidget.MultiSelection)

        self.controlArea.setFixedSize(150, 250)
        self.adjustSize()

        # The following assignments usually don't take place in __init__
        # but later on, when the widget receives some data
        import orange
        self.data = orange.ExampleTable(r"..\datasets\horse-colic.tab")
        self.attributes = [(attr.name, attr.varType)
                           for attr in self.data.domain]
        self.chosenAttribute = [0]
Ejemplo n.º 18
0
    def __init__(self, parent=None):
        OWWidget.__init__(self, parent, title='Listbox')

        self.method = 0

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

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

        OWGUI.separator(self.controlArea)

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

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

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

        self.primary = None
        self.additional = {}

        self.loadSettings()

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

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

        self.adjustSize()
Ejemplo n.º 22
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.º 23
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "Calibration Plot", 1)

        # inputs
        self.inputs=[("Evaluation Results", orngTest.ExperimentResults, self.results, Default)]

        #set default settings
        self.CalibrationCurveWidth = 3
        self.ShowDiagonal = TRUE
        self.ShowRugs = TRUE
        #load settings
        self.loadSettings()

        # temp variables
        self.dres = None
        self.targetClass = None
        self.numberOfClasses = 0
        self.graphs = []
        self.classifierColor = None
        self.numberOfClassifiers = 0
        self.classifiers = []
        self.selectedClassifiers = []

        # GUI
        import sip
        sip.delete(self.mainArea.layout())
        self.graphsGridLayoutQGL = QGridLayout(self.mainArea)
        self.mainArea.setLayout(self.graphsGridLayoutQGL)

        ## save each ROC graph in separate file
        self.graph = None
        self.connect(self.graphButton, SIGNAL("clicked()"), self.saveToFile)

        ## general tab
        self.tabs = OWGUI.tabWidget(self.controlArea)
        self.generalTab = OWGUI.createTabPage(self.tabs, "General")
        self.settingsTab = OWGUI.createTabPage(self.tabs, "Settings")

        self.splitQS = QSplitter()
        self.splitQS.setOrientation(Qt.Vertical)

        ## target class
        self.classCombo = OWGUI.comboBox(self.generalTab, self, 'targetClass', box='Target class', items=[], callback=self.target)
        OWGUI.separator(self.generalTab)

        ## classifiers selection (classifiersQLB)
        self.classifiersQVGB = OWGUI.widgetBox(self.generalTab, "Classifiers")
        self.classifiersQLB = OWGUI.listBox(self.classifiersQVGB, self, "selectedClassifiers", selectionMode = QListWidget.MultiSelection, callback = self.classifiersSelectionChange)
        self.unselectAllClassifiersQLB = OWGUI.button(self.classifiersQVGB, self, "(Un)select all", callback = self.SUAclassifiersQLB)

        ## settings tab
        OWGUI.hSlider(self.settingsTab, self, 'CalibrationCurveWidth', box='Calibration Curve Width', minValue=1, maxValue=9, step=1, callback=self.setCalibrationCurveWidth, ticks=1)
        OWGUI.checkBox(self.settingsTab, self, 'ShowDiagonal', 'Show Diagonal Line', tooltip='', callback=self.setShowDiagonal)
        OWGUI.checkBox(self.settingsTab, self, 'ShowRugs', 'Show Rugs', tooltip='', callback=self.setShowRugs)
        self.settingsTab.layout().addStretch(100)
Ejemplo n.º 24
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)
Ejemplo n.º 25
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'PurgeDomain')
        self.settingsList=["removeValues", "removeAttributes", "removeClassAttribute", "removeClasses", "autoSend", "sortValues", "sortClasses"]

        self.inputs = [("Examples", ExampleTable, self.setData)]
        self.outputs = [("Examples", 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")
        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)
        boxH = OWGUI.widgetBox(boxAt, orientation="horizontal")
        OWGUI.separator(boxH, width=30, height=0)
        ruv = OWGUI.checkBox(boxH, self, "removeValues", "Remove unused attribute values", callback = self.optionsChanged)
        rua.disables = [ruv]

        OWGUI.separator(self.controlArea)

        boxAt = OWGUI.widgetBox(self.controlArea, "Classes")
        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)
        boxH = OWGUI.widgetBox(boxAt, orientation="horizontal")
        OWGUI.separator(boxH, width=30, height=0)
        ruv = OWGUI.checkBox(boxH, self, "removeClasses", "Remove unused class values", callback = self.optionsChanged)
        rua.disables = [ruv]

        OWGUI.separator(self.controlArea)
        box2 = OWGUI.widgetBox(self.controlArea)
        btSend = OWGUI.button(box2, self, "Send data", callback = self.process)
        cbAutoSend = OWGUI.checkBox(box2, self, "autoSend", "Send automatically")

        OWGUI.setStopper(self, btSend, cbAutoSend, "dataChanged", self.process)

        OWGUI.separator(self.controlArea, height=24)

        box3 = OWGUI.widgetBox(self.controlArea, 'Statistics')
        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")
    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).")
    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()
Ejemplo n.º 28
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.º 29
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "Pubmed Network View", wantMainArea=0)

        self.inputs = []
        self.outputs = [("Nx View", Orange.network.NxView)]

        self._nhops = 2
        self._edge_threshold = 0.5
        self._n_max_neighbors = 20
        self.selected_titles = []
        self.titles = []
        self.filter = ""
        self.ids = []
        self._selected_nodes = []
        self._algorithm = 0
        self._k_algorithm = 0.3

        self.loadSettings()

        box = OWGUI.widgetBox(self.controlArea, "Paper Selection", orientation="vertical")
        OWGUI.lineEdit(box, self, "filter", callback=self.filter_list, callbackOnType=True)
        self.list_titles = OWGUI.listBox(
            box, self, "selected_titles", "titles", selectionMode=QListWidget.MultiSelection, callback=self.update_view
        )
        OWGUI.separator(self.controlArea)
        box_pref = OWGUI.widgetBox(self.controlArea, "Preferences", orientation="vertical")
        OWGUI.spin(box_pref, self, "_nhops", 1, 6, 1, label="Number of hops: ", callback=self.update_view)
        OWGUI.spin(
            box_pref, self, "_n_max_neighbors", 1, 100, 1, label="Max number of neighbors: ", callback=self.update_view
        )
        OWGUI.doubleSpin(
            box_pref, self, "_edge_threshold", 0, 1, step=0.01, label="Edge threshold: ", callback=self.update_view
        )
        OWGUI.separator(self.controlArea)
        box_alg = OWGUI.widgetBox(self.controlArea, "Interest Propagation Algorithm", orientation="vertical")
        radio_box = OWGUI.radioButtonsInBox(box_alg, self, "_algorithm", [], callback=self.update_view)
        OWGUI.appendRadioButton(radio_box, self, "_algorithm", "Without Clustering", callback=self.update_view)
        OWGUI.doubleSpin(
            OWGUI.indentedBox(radio_box),
            self,
            "_k_algorithm",
            0,
            1,
            step=0.01,
            label="Parameter k: ",
            callback=self.update_view,
        )
        OWGUI.appendRadioButton(radio_box, self, "_algorithm", "With Clustering", callback=self.update_view)

        self.inside_view = PubmedNetworkView(self)
        self.send("Nx View", self.inside_view)
Ejemplo n.º 30
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.º 31
0
    def __init__(self, parent=None, signalManager = None, name='Random Forests'):
        OWWidget.__init__(self, parent, signalManager, name)

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

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


	self.maxTrees = 10000

        self.loadSettings()

        self.data = None
        self.preprocessor = None

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

        OWGUI.separator(self.controlArea)

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

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

        OWGUI.separator(self.controlArea)

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

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

        OWGUI.separator(self.controlArea)

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

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

	OWGUI.separator(self.controlArea)

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

        self.resize(100,200)

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

        self.callbackDeposit = []

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

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

        self.convertToOrange = 1

        self.loadSettings()

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

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

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

        OWGUI.separator(self.controlArea)

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

        OWGUI.separator(self.controlArea)

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

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

#        OWGUI.separator(self.controlArea)

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

        OWGUI.separator(self.controlArea)

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

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

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

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

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

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

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

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

        OWGUI.rubber(buildTab)

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

        self.callbackDeposit = []

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

        self.useLazyEvaluation = pynopticon.useLazyEvaluation

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

        self.data = None  # input data set

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

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

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

        self.resize(100, 150)
Ejemplo n.º 35
0
    def defineGUI(self):        

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

        OWGUI.separator(self.controlArea, 0, 30)

        self.bBox = self.controlArea# QGroupBox('Model parameters for the Random Forest algorithm',self.controlArea)
        #self.bBox.setTitle('Model parameters for the Random Forest algorithm')

        OWGUI.lineEdit(self.bBox, self, 'nActVars', box='The number of active attributes', \
                       tooltip='The number of randomly sampled attributes at each node.\nThe default value 0, sets the number of samples \nto the square root of the total number of samples.')
        OWGUI.lineEdit(self.bBox, self, 'maxDepth', box='Maximum branching depth.', \
                       tooltip='The maximal number of nodes along one branch')
        OWGUI.lineEdit(self.bBox, self, 'minSample', box='Minimum number of samples', \
                       tooltip='The number of samples at which to stop branching.')

        self.trainingBox=b=QButtonGroup(self.bBox)#"Termination criteria", self.bBox)
        self.trainingBox=b=OWGUI.widgetBox(self.bBox, "Termination criteria")
        self.trainingRadio = OWGUI.radioButtonsInBox(b, self, "termCrit", btnLabels= \
                             ["Number of trees in the forest", "Out of bag error to achive before termination          "])
        OWGUI.lineEdit(self.bBox, self, 'nTrees', box='The number of trees', \
                       tooltip='This is the termination criteria used if "Number of trees in the forest" is checked')
        OWGUI.lineEdit(self.bBox, self, 'forestAcc', box='OOB error', \
                       tooltip='This is the termination criteria used if "Out of bag error" is checked')
        self.priorBox = OWGUI.lineEdit(self.bBox, self, 'priorsGUI', box='Class weights ', \
                       tooltip='Ex: POS:0.8 , NEG:0.2')
        #OWGUI.separator(self.bBox, 0, 5)
        #OWGUI.checkBox(self.bBox, self, 'stratify','Stratify',  tooltip='Stratify?')
        OWGUI.checkBox(self.bBox, self, 'useBuiltInMissValHandling','Use surrogate nodes for missing value handling',  tooltip='Use the RF built in missing value handling (as originally implemented by Breiman and Cutler) instead of the AZorange imputer. The training will be more time consuming and the model larger.')

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

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

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

        self.resize(200,400)
Ejemplo n.º 36
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.º 37
0
    def __init__(self, parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, 'ExampleDistance', wantMainArea = 0, resizingEnabled = 0)

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

        self.Metrics = 0
        self.Normalize = True
        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.distMetricChanged, valueType=str)
        cb.setMinimumWidth(170)
        
        OWGUI.separator(self.controlArea)
        
        box = OWGUI.widgetBox(self.controlArea, "Normalization", 
                              addSpace=True)
        self.normalizeCB = OWGUI.checkBox(box, self, "Normalize", "Normalize data", 
                                          callback=self.computeMatrix)
        
        self.normalizeCB.setEnabled(self.Metrics in [0, 3])
        
        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)
Ejemplo n.º 38
0
    def __init__(self, parent=None):
        OWWidget.__init__(self, parent, title='Listbox')

        self.colors = ["Red", "Green", "Blue"]
        self.chosenColor = [2]
        self.numbers = ["One", "Two", "Three", "Four"]
        self.chosenNumbers = [0, 2, 3]

        OWGUI.listBox(self.controlArea, self, "chosenColor", "colors", box="Color", callback=self.checkAll)
        OWGUI.listBox(self.controlArea, self, "chosenNumbers", "numbers", box="Number", selectionMode=QListWidget.MultiSelection, callback=self.checkAll)

        OWGUI.separator(self.controlArea)
        
        box = OWGUI.widgetBox(self.controlArea, "Debug info")
        OWGUI.label(box, self, "Color: %(chosenColor)s")
        OWGUI.label(box, self, "Numbers: %(chosenNumbers)s", labelWidth=100)

        self.setFixedSize(110, 280)
Ejemplo n.º 39
0
    def __init__(self, parent=None, signalManager = None, name='sift'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0)

        self.callbackDeposit = []

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

        
        
        # Settings
        self.name = name
	self.sift = None

	self.useLazyEvaluation = armor.useLazyEvaluation
	
        self.Octave = 6
        self.Levels = 3
        self.FirstOctave = 0
        self.PeakThresh = 0
        self.EdgeThresh = 10
	self.NormThresh = 0
        self.Orientations = 0

        self.loadSettings()
        
        self.data = None                    # input data set

        wbN = OWGUI.widgetBox(self.controlArea, "Sift Settings")
        OWGUI.spin(wbN, self, "Octave", -1, 8, 1, None, "Octaves   ", orientation="horizontal")
        OWGUI.spin(wbN, self, "Levels", 1, 8, 1, None, "Levels   ", orientation="horizontal")
        OWGUI.spin(wbN, self, "FirstOctave", 0, 8, 1, None, "First Octave ", orientation="horizontal")
        OWGUI.spin(wbN, self, "PeakThresh", -1, 8, 1, None, "PeakThresh", orientation="horizontal")
        OWGUI.spin(wbN, self, "EdgeThresh", -1, 8, 1, None, "EdgeThresh", orientation="horizontal")
	OWGUI.spin(wbN, self, "NormThresh", -1, 8, 1, None, "NormThresh", orientation="horizontal")    
        OWGUI.spin(wbN, self, "Orientations", 0, 1, 1, None, "Force computation of orientations", orientation="horizontal")
        wbS = OWGUI.widgetBox(self.controlArea, "Widget Settings")
        OWGUI.checkBox(wbS, self, "useLazyEvaluation", "Use lazy evaluation")
        OWGUI.separator(self.controlArea)
        
        OWGUI.button(self.controlArea, self, "&Apply Settings", callback = self.applySettings, disabled=0)

        self.resize(100,250)
Ejemplo n.º 40
0
    def add_tables(self, networks):
        self.networks = networks
        self.tables = []
        
        if networks is None:
            return
        
        networks.sort(key=lambda net: net.repository)
        for k,g in itertools.groupby(networks, key=lambda net: net.repository):
            network_group = list(g)
        
            if len(network_group) > 0:
                self.network_list.layout().addWidget(QLabel("<h3>" + network_group[0].repository + "</h3>"))
                table = OWGUI.table(self.network_list, rows=len(network_group), columns=5, selectionMode = -1, addToLayout = 1)
                table.setHorizontalHeaderLabels(['Name', 'Type', 'Nodes', 'Edges', 'Description'])
                f = table.font()
                f.setPointSize(9)
                table.setFont(f)
                table.verticalHeader().hide()
                table.setSelectionMode(QAbstractItemView.SingleSelection)
                table.setSelectionBehavior(QAbstractItemView.SelectRows)
                self.connect(table, SIGNAL('itemSelectionChanged()'), lambda table=table: self.select_network(table))
            
                for i, net in enumerate(network_group):
                    lbl = QLabel("<a href='"+ net.link +"'>" + net.name + "</a>")
                    lbl.setOpenExternalLinks(True)
                    table.setCellWidget(i, 0, lbl)
                    OWGUI.tableItem(table, i, 1, net.type)
                    OWGUI.tableItem(table, i, 2, net.nodes)
                    OWGUI.tableItem(table, i, 3, net.edges)
                    OWGUI.tableItem(table, i, 4, net.description)
 
                table.setFixedSize(712, 100)
                table.setColumnWidth(0, 120)
                table.setColumnWidth(1, 80)
                table.setColumnWidth(2, 80)
                table.setColumnWidth(3, 80)
                table.setColumnWidth(4, 350)
                table.resizeRowsToContents()                   
                table.setFixedSize(712, sum(table.rowHeight(i) for i in range(len(networks))) + 27)
                self.tables.append(table)
                
                OWGUI.separator(self.network_list, 10, 10)
Ejemplo n.º 41
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, 'LearningCurveA')

        self.inputs = [("Data", ExampleTable, self.dataset),
                       ("Learner", orange.Learner, self.learner, Multiple)]
        
        self.folds = 5     # cross validation folds
        self.steps = 10    # points in the learning curve
        self.scoringF = 0  # scoring function
        self.commitOnChange = 1 # compute curve on any change of parameters
        self.loadSettings()
        self.setCurvePoints() # sets self.curvePoints, self.steps equidistantpoints from 1/self.steps to 1
        self.scoring = [("Classification Accuracy", orngStat.CA), ("AUC", orngStat.AUC), ("BrierScore", orngStat.BrierScore), ("Information Score", orngStat.IS), ("Sensitivity", orngStat.sens), ("Specificity", orngStat.spec)]
        self.learners = [] # list of current learners from input channel, tuples (id, learner)
        self.data = None   # data on which to construct the learning curve
        self.curves = []   # list of evaluation results (one per learning curve point)
        self.scores = []   # list of current scores, learnerID:[learner scores]

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

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

        OWGUI.separator(self.controlArea)
        box = OWGUI.widgetBox(self.controlArea, "Options")
        OWGUI.spin(box, self, 'folds', 2, 100, step=1, label='Cross validation folds:  ',
                   callback=lambda: self.computeCurve(self.commitOnChange))
        OWGUI.spin(box, self, 'steps', 2, 100, step=1, label='Learning curve points:  ',
                   callback=[self.setCurvePoints, lambda: self.computeCurve(self.commitOnChange)])

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

        # table widget
        self.table = OWGUI.table(self.mainArea, selectionMode=QTableWidget.NoSelection)
                
        self.resize(500,200)
Ejemplo n.º 42
0
    def __init__(self,
                 parent=None,
                 signalManager=None,
                 name='ExtractFeatures'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0)

        self.callbackDeposit = []

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

        self.useLazyEvaluation = pynopticon.useLazyEvaluation

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

        self.data = None  # input data set

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

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

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

        self.resize(100, 150)
Ejemplo n.º 43
0
    def __init__(self, parent=None, signalManager = None, name='Random Forest'):
        OWWidget.__init__(self, parent, signalManager, name, wantMainArea=False, resizingEnabled=False)

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

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

        self.maxTrees = 10000

        self.loadSettings()

        self.data = None
        self.preprocessor = None

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

        OWGUI.separator(self.controlArea)

        self.bBox = OWGUI.widgetBox(self.controlArea, 'Basic Properties')

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

        OWGUI.separator(self.controlArea)

        self.pBox = OWGUI.widgetBox(self.controlArea, 'Growth Control')

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

        OWGUI.separator(self.controlArea)

        OWGUI.separator(self.controlArea)

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

        self.resize(100,200)

        self.setLearner()
Ejemplo n.º 44
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.º 45
0
    def __init__(self,parent=None, signalManager = None):
        OWWidget.__init__(self, parent, signalManager, "AssociationRules", wantMainArea = 0)

        self.inputs = [("Data", 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, default=True)

        OWGUI.rubber(self.controlArea)
        
        self.adjustSize()
Ejemplo n.º 46
0
    def __init__(self, parent=None):
        OWWidget.__init__(self, parent, title='X Learner')

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

        self.settingsChanged = False

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

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

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

        OWGUI.setStopper(self, applyButton, autoApplyCB, "settingsChanged",
                         self.apply)

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

        self.callbackDeposit = []

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

        self.useLazyEvaluation = pynopticon.useLazyEvaluation

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

        self.data = None  # input data set

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

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

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

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

        self.callbackDeposit = []

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

        self.useLazyEvaluation = pynopticon.useLazyEvaluation

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

        self.data = None  # input data set

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

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

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

        self.resize(100, 150)
Ejemplo n.º 49
0
 def __init__(self, parent=None, signalManager=None):
     OWWidget.__init__(self, parent, signalManager, 'Pubmed Network View', wantMainArea=0)
     
     self.inputs = []
     self.outputs = [("Nx View", Orange.network.NxView)]
     
     self._nhops = 2
     self._edge_threshold = 0.5
     self._n_max_neighbors = 20
     self.selected_titles = []
     self.titles = []
     self.filter = ''
     self.ids = []
     self._selected_nodes = []
     self._algorithm = 0
     self._k_algorithm = 0.3
     
     self.loadSettings()
     
     box = OWGUI.widgetBox(self.controlArea, "Paper Selection", orientation="vertical")
     OWGUI.lineEdit(box, self, "filter", callback=self.filter_list, callbackOnType=True)
     self.list_titles = OWGUI.listBox(box, self, "selected_titles", "titles", selectionMode=QListWidget.MultiSelection, callback=self.update_view)
     OWGUI.separator(self.controlArea)
     box_pref = OWGUI.widgetBox(self.controlArea, "Preferences", orientation="vertical")
     OWGUI.spin(box_pref, self, "_nhops", 1, 6, 1, label="Number of hops: ", callback=self.update_view)
     OWGUI.spin(box_pref, self, "_n_max_neighbors", 1, 100, 1, label="Max number of neighbors: ", callback=self.update_view)
     OWGUI.doubleSpin(box_pref, self, "_edge_threshold", 0, 1, step=0.01, label="Edge threshold: ", callback=self.update_view)
     OWGUI.separator(self.controlArea)
     box_alg = OWGUI.widgetBox(self.controlArea, "Interest Propagation Algorithm", orientation="vertical")
     radio_box = OWGUI.radioButtonsInBox(box_alg, self, "_algorithm", [], callback=self.update_view)
     OWGUI.appendRadioButton(radio_box, self, "_algorithm", "Without Clustering", callback=self.update_view)
     OWGUI.doubleSpin(OWGUI.indentedBox(radio_box), self, "_k_algorithm", 0, 1, step=0.01, label="Parameter k: ", callback=self.update_view)
     OWGUI.appendRadioButton(radio_box, self, "_algorithm", "With Clustering", callback=self.update_view)
     
     self.inside_view = PubmedNetworkView(self)
     self.send("Nx View", self.inside_view)
Ejemplo n.º 50
0
    def __init__(self, parent=None, signalManager=None):
        OWWidget.__init__(self, parent, signalManager, "Regression Tree", wantMainArea = 0, resizingEnabled = 0)
        self.Name="Regression Tree"
        self.MinInstCheck=1
        self.MinInstVal=5
        self.MinNodeCheck=1
        self.MinNodeVal=10
        self.MaxMajCheck=1
        self.MaxMajVal=70
        self.PostMaj=1
        self.PostMPCheck=1
        self.PostMPVal=5
        self.Bin=1
        self.loadSettings()

        self.data=None
        self.preprocessor = None

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

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

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

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

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

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

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

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

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

        OWGUI.button(self.controlArea, self, "&Apply settings",callback=self.setLearner)
        
        OWGUI.rubber(self.controlArea)
        self.setLearner()
        self.resize(100,100)