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()
def __init__(self, parent=None): OWWidget.__init__(self, parent, "CheckSpin") self.val = 20 self.chk = 1 OWGUI.checkWithSpin(self.controlArea, self, "Prunning, m=", 0, 100, "chk", "val", posttext="%") self.resize(100, 100)
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Regression Tree", wantMainArea = 0, resizingEnabled = 0) self.Name="Regression Tree" self.MinInstCheck=1 self.MinInstVal=5 self.MinNodeCheck=1 self.MinNodeVal=10 self.MaxMajCheck=1 self.MaxMajVal=70 self.PostMaj=1 self.PostMPCheck=1 self.PostMPVal=5 self.Bin=1 self.loadSettings() self.data=None self.preprocessor = None self.inputs=[("Data",ExampleTable,self.dataset), ("Preprocess", PreprocessedLearner, self.setPreprocessor)] self.outputs=[("Learner", orange.Learner), ("Regressor", orange.Classifier), ("Regression Tree", Orange.regression.tree.TreeClassifier)] ## #GUI ## OWGUI.lineEdit(self.controlArea, self, "Name", box="Learner/Classifier name") OWGUI.separator(self.controlArea) OWGUI.checkBox(self.controlArea, self, "Bin", label="Binarization", box ="Tree structure") OWGUI.separator(self.controlArea) self.prePBox=OWGUI.widgetBox(self.controlArea, "Pre-Pruning") #OWGUI.checkWithSpin(self.prePBox, self, "Min. instances in leaves: ", 1, 1000, # "MinInstCheck", "MinInstVal") OWGUI.checkWithSpin(self.prePBox, self, "Do not split nodes with less instances than", 1, 1000, "MinNodeCheck", "MinNodeVal") #OWGUI.checkWithSpin(self.prePBox, self, "Stop splitting nodes with ", 1, 100, # "MaxMajCheck", "MaxMajVal", "% of majority class") #OWGUI.checkBox(self.postPBox, self, 'PostMaj', 'Recursively merge leaves with same majority class') OWGUI.separator(self.controlArea) self.postPBox=OWGUI.widgetBox(self.controlArea, "Post-Pruning") OWGUI.checkWithSpin(self.postPBox, self, "Pruning with m-estimate, m:", 0, 1000, 'PostMPCheck', 'PostMPVal') OWGUI.button(self.controlArea, self, "&Apply settings", callback=self.setLearner, default=True) OWGUI.rubber(self.controlArea) self.setLearner() self.resize(100,100)
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()
def __init__(self, parent=None, signalManager = None, name='C4.5'): OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0) self.callbackDeposit = [] self.inputs = [("Data", ExampleTable, self.setData), ("Preprocess", PreprocessedLearner, self.setPreprocessor)] self.outputs = [("Learner", orange.Learner), ("Classification Tree", Orange.classification.tree.TreeClassifier)]#, ("C45 Tree", orange.C45Classifier)] # Settings self.name = 'C4.5' self.infoGain = 0; self.subset = 0; self.probThresh = 0; self.useMinObjs = 1; self.minObjs = 2; self.prune = 1; self.cf = 25 self.iterative = 0; self.manualWindow = 0; self.window = 50; self.manualIncrement = 0; self.increment = 10; self.trials = 10 self.convertToOrange = 1 self.loadSettings() self.data = None # input data set self.preprocessor = None # no preprocessing as default OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name', tooltip='Name to be used by other widgets to identify your learner/classifier.') OWGUI.separator(self.controlArea) self.wbSplit = OWGUI.widgetBox(self.controlArea, "Splitting") OWGUI.checkBox(self.wbSplit, self, 'infoGain', 'Use information gain instead of ratio (-g)') OWGUI.checkBox(self.wbSplit, self, 'subset', 'Subsetting (-s)') OWGUI.checkBox(self.wbSplit, self, 'probThresh', 'Probabilistic threshold for continuous attributes (-p)') OWGUI.separator(self.controlArea) self.wbPruning = OWGUI.widgetBox(self.controlArea, "Pruning") OWGUI.checkWithSpin(self.wbPruning, self, 'Minimal examples in leaves (-m)', 1, 1000, 'useMinObjs', 'minObjs', '', 1, labelWidth = 225) OWGUI.checkWithSpin(self.wbPruning, self, 'Post pruning with confidence level (-cf) of ', 0, 100, 'prune', 'cf', '', 5, labelWidth = 225) OWGUI.separator(self.controlArea) self.wbIterative = OWGUI.widgetBox(self.controlArea, "Iterative generation") self.cbIterative = OWGUI.checkBox(self.wbIterative, self, 'iterative', 'Generate the tree iteratively (-i, -t, -w)') self.spTrial = OWGUI.spin(self.wbIterative, self, 'trials', 1, 30, 1, '', " Number of trials (-t)", orientation = "horizontal", labelWidth = 225) self.csWindow = OWGUI.checkWithSpin(self.wbIterative, self, "Manually set initial window size (-w) to ", 10, 1000, 'manualWindow', 'window', '', 10, labelWidth = 225) self.csIncrement = OWGUI.checkWithSpin(self.wbIterative, self, "Manually set window increment (-i) to ", 10, 1000, 'manualIncrement', 'increment', '', 10, labelWidth = 225) self.cbIterative.disables = [self.spTrial, self.csWindow, self.csIncrement] self.cbIterative.makeConsistent() # OWGUI.separator(self.controlArea) # OWGUI.checkBox(self.controlArea, self, 'convertToOrange', 'Convert to orange tree structure', box = 1) OWGUI.separator(self.controlArea) OWGUI.button(self.controlArea, self, "&Apply", callback = self.setLearner, disabled=0, default=True) OWGUI.rubber(self.controlArea) self.setLearner()
def __init__(self, parent=None, signalManager=None, name='Classification Tree'): OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0, resizingEnabled=0) self.inputs = [("Data", ExampleTable, self.setData), ("Preprocess", PreprocessedLearner, self.setPreprocessor)] self.outputs = [("Learner", Orange.classification.tree.TreeLearner), ("Classification Tree", Orange.classification.tree.TreeClassifier), ] self.name = 'Classification Tree' self.estim = 0; self.relK = 5; self.relM = 100; self.limitRef = True self.bin = 0; self.subset = 0 self.preLeafInstP = 2; self.preNodeInstP = 5; self.preNodeMajP = 95 self.preLeafInst = 1; self.preNodeInst = 0; self.preNodeMaj = 0 self.postMaj = 1; self.postMPruning = 1; self.postM = 2.0 self.limitDepth = False; self.maxDepth = 100 self.loadSettings() self.data = None self.preprocessor = None self.setLearner() OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name', tooltip='Name to be used by other widgets to identify your learner/classifier.') OWGUI.separator(self.controlArea) qBox = OWGUI.widgetBox(self.controlArea, 'Attribute selection criterion') self.qMea = OWGUI.comboBox(qBox, self, "estim", items=[m[0] for m in self.measures], callback=self.measureChanged) b1 = OWGUI.widgetBox(qBox, orientation="horizontal") OWGUI.separator(b1, 16, 0) b2 = OWGUI.widgetBox(b1) self.cbLimitRef, self.hbxRel1 = OWGUI.checkWithSpin(b2, self, "Limit the number of reference examples to ", 1, 1000, "limitRef", "relM") OWGUI.separator(b2) self.hbxRel2 = OWGUI.spin(b2, self, "relK", 1, 50, orientation="horizontal", label="Number of neighbours in ReliefF ") OWGUI.separator(self.controlArea) OWGUI.radioButtonsInBox(self.controlArea, self, 'bin', self.binarizationOpts, "Binarization") OWGUI.separator(self.controlArea) self.measureChanged() self.pBox = OWGUI.widgetBox(self.controlArea, 'Pre-Pruning') self.preLeafInstBox, self.preLeafInstPBox = OWGUI.checkWithSpin(self.pBox, self, "Min. instances in leaves ", 1, 1000, "preLeafInst", "preLeafInstP") self.preNodeInstBox, self.preNodeInstPBox = OWGUI.checkWithSpin(self.pBox, self, "Stop splitting nodes with less instances than ", 1, 1000, "preNodeInst", "preNodeInstP") self.preNodeMajBox, self.preNodeMajPBox = OWGUI.checkWithSpin(self.pBox, self, "Stop splitting nodes with a majority class of (%)", 1, 100, "preNodeMaj", "preNodeMajP") self.cbLimitDepth, self.maxDepthBox = OWGUI.checkWithSpin(self.pBox, self, "Stop splitting nodes at depth", 0, 1000, "limitDepth", "maxDepth") OWGUI.separator(self.controlArea) self.mBox = OWGUI.widgetBox(self.controlArea, 'Post-Pruning') OWGUI.checkBox(self.mBox, self, 'postMaj', 'Recursively merge leaves with same majority class') self.postMPruningBox, self.postMPruningPBox = OWGUI.checkWithSpin(self.mBox, self, "Pruning with m-estimate, m=", 0, 1000, 'postMPruning', 'postM') OWGUI.separator(self.controlArea) self.btnApply = OWGUI.button(self.controlArea, self, "&Apply", callback=self.setLearner, disabled=0, default=True) OWGUI.rubber(self.controlArea) self.resize(200, 200)
def __init__ (self, parent=None, signalManager = None, name = "Logistic regression"): OWWidget.__init__(self, parent, signalManager, name, wantMainArea = 0, resizingEnabled = 0) self.inputs = [("Data", ExampleTable, self.setData), ("Preprocess", PreprocessedLearner, self.setPreprocessor)] self.outputs = [("Learner", orange.Learner), ("Classifier", orange.Classifier), ("Features", list)] from orngTree import TreeLearner imputeByModel = orange.ImputerConstructor_model() imputeByModel.learnerDiscrete = TreeLearner(measure = "infoGain", minSubset = 50) imputeByModel.learnerContinuous = TreeLearner(measure = "retis", minSubset = 50) self.imputationMethods = [imputeByModel, orange.ImputerConstructor_average(), orange.ImputerConstructor_minimal(), orange.ImputerConstructor_maximal(), None] self.imputationMethodsStr = ["Classification/Regression trees", "Average values", "Minimal value", "Maximal value", "None (skip examples)"] self.name = "Logistic regression" self.univariate = 0 self.stepwiseLR = 0 self.addCrit = 10 self.removeCrit = 10 self.numAttr = 10 self.limitNumAttr = False self.zeroPoint = 0 self.imputation = 1 self.data = None self.preprocessor = None self.loadSettings() OWGUI.lineEdit(self.controlArea, self, 'name', box='Learner/Classifier Name', tooltip='Name to be used by other widgets to identify your learner/classifier.') OWGUI.separator(self.controlArea) box = OWGUI.widgetBox(self.controlArea, "Attribute selection") stepwiseCb = OWGUI.checkBox(box, self, "stepwiseLR", "Stepwise attribute selection") ibox = OWGUI.indentedBox(box, sep=OWGUI.checkButtonOffsetHint(stepwiseCb)) addCritSpin = OWGUI.spin(ibox, self, "addCrit", 1, 50, label="Add threshold [%]", labelWidth=155, tooltip="Requested significance for adding an attribute") remCritSpin = OWGUI.spin(ibox, self, "removeCrit", 1, 50, label="Remove threshold [%]", labelWidth=155, tooltip="Requested significance for removing an attribute") limitAttSpin = OWGUI.checkWithSpin(ibox, self, "Limit number of attributes to ", 1, 100, "limitNumAttr", "numAttr", step=1, labelWidth=155, tooltip="Maximum number of attributes. Algorithm stops when it selects specified number of attributes.") stepwiseCb.disables += [addCritSpin, remCritSpin, limitAttSpin] stepwiseCb.makeConsistent() OWGUI.separator(self.controlArea) self.imputationCombo = OWGUI.comboBox(self.controlArea, self, "imputation", box="Imputation of unknown values", items=self.imputationMethodsStr) OWGUI.separator(self.controlArea) applyButton = OWGUI.button(self.controlArea, self, "&Apply", callback=self.applyLearner, default=True) OWGUI.rubber(self.controlArea) #self.adjustSize() self.applyLearner()
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, 'SampleData', wantMainArea = 0) self.inputs = [("Data", ExampleTable, self.setData)] self.outputs = [("Data Sample", ExampleTable), ("Remaining Data", ExampleTable)] # initialization of variables self.data = None # dataset (incoming stream) self.indices = None # indices that control sampling self.ind = None # indices that control sampling self.Stratified = 1 # use stratified sampling if possible? self.Repeat = 0 # can elements repeat in a sample? self.UseSpecificSeed = 0 # use a specific random seed? self.RandomSeed = 1 # specific seed used self.GroupSeed = 1 # current seed for multiple group selection self.outFold = 1 # folder/group to output self.Folds = 1 # total number of folds/groups self.SelectType = 0 # sampling type (LOO, CV, ...) self.useCases = 0 # use a specific number of cases? self.nCases = 25 # number of cases to use self.selPercentage = 30 # sample size in % self.LOO = 1 # use LOO? self.CVFolds = 10 # number of CV folds self.CVFoldsInternal = 10 # number of CV folds (for internal use) self.nGroups = 3 # number of groups self.pGroups = [0.1,0.25,0.5] # sizes of groups self.GroupText = '0.1,0.25,0.5' # assigned to Groups Control (for internal use) self.loadSettings() # GUI # Info Box box1 = OWGUI.widgetBox(self.controlArea, "Information", addSpace=True) self.infoa = OWGUI.widgetLabel(box1, 'No data on input.') self.infob = OWGUI.widgetLabel(box1, ' ') self.infoc = OWGUI.widgetLabel(box1, ' ') # Options Box box2 = OWGUI.widgetBox(self.controlArea, 'Options', addSpace=True) OWGUI.checkBox(box2, self, 'Stratified', 'Stratified (if possible)', callback=self.settingsChanged) OWGUI.checkWithSpin(box2, self, 'Set random seed:', 0, 32767, 'UseSpecificSeed', 'RandomSeed', checkCallback=self.settingsChanged, spinCallback=self.settingsChanged) # Sampling Type Box self.s = [None, None, None, None] self.sBox = OWGUI.widgetBox(self.controlArea, "Sampling type", addSpace=True) self.sBox.buttons = [] # Random Sampling self.s[0] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", 'Random sampling') # indent indent = sep=OWGUI.checkButtonOffsetHint(self.s[0]) # repeat checkbox self.h1Box = OWGUI.indentedBox(self.sBox, sep=indent, orientation = "horizontal") OWGUI.checkBox(self.h1Box, self, 'Repeat', 'With replacement', callback=self.settingsChanged) # specified number of elements checkbox self.h2Box = OWGUI.indentedBox(self.sBox, sep=indent, orientation = "horizontal") OWGUI.checkWithSpin(self.h2Box, self, 'Sample size (instances):', 1, 1000000000, 'useCases', 'nCases', checkCallback=[self.uCases, self.settingsChanged], spinCallback=self.settingsChanged) OWGUI.rubber(self.h2Box) # percentage slider self.h3Box = OWGUI.indentedBox(self.sBox, sep=indent, orientation = "horizontal") OWGUI.widgetLabel(self.h3Box, "Sample size:") self.slidebox = OWGUI.indentedBox(self.sBox, sep=indent, orientation = "horizontal") OWGUI.hSlider(self.slidebox, self, 'selPercentage', minValue=1, maxValue=100, step=1, ticks=10, labelFormat=" %d%%", callback=self.settingsChanged) # Cross Validation self.s[1] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", 'Cross validation') box = OWGUI.indentedBox(self.sBox, sep=indent, orientation = "horizontal") OWGUI.spin(box, self, 'CVFolds', 2, 100, step=1, label='Number of folds: ', callback=[self.changeCombo, self.settingsChanged]) OWGUI.rubber(box) # Leave-One-Out self.s[2] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", 'Leave-one-out') # Multiple Groups self.s[3] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", 'Multiple subsets') gbox = OWGUI.indentedBox(self.sBox, sep=indent, orientation = "horizontal") OWGUI.lineEdit(gbox, self, 'GroupText', label='Subset sizes (e.g. "0.1, 0.2, 0.5"):', callback=self.multipleChanged) # Output Group Box self.foldcombo = OWGUI.comboBox(self.controlArea, self, "outFold", 'Output Data for Fold / Group', 'Fold / group:', orientation = "horizontal", items = range(1,101), callback = self.foldChanged, sendSelectedValue = 1, valueType = int) self.foldcombo.setEnabled(False) # Select Data Button OWGUI.rubber(self.controlArea) self.sampleButton = OWGUI.button(self.controlArea, self, 'Sample &Data', callback = self.process, addToLayout=False, default=True) self.buttonBackground.layout().setDirection(QBoxLayout.TopToBottom) self.buttonBackground.layout().insertWidget(0, self.sampleButton) self.buttonBackground.show() self.s[self.SelectType].setChecked(True) # set initial radio button on (default sample type) # CONNECTIONS # set connections for RadioButton (SelectType) self.dummy1 = [None]*len(self.s) for i in range(len(self.s)): self.dummy1[i] = lambda x, v=i: self.sChanged(x, v) self.connect(self.s[i], SIGNAL("toggled(bool)"), self.dummy1[i]) # final touch self.resize(200, 275)
def __init__(self, parent=None, signalManager = None, name='TreeViewer2D'): OWWidget.__init__(self, parent, signalManager, name, wantGraph=True) self.root = None self.selectedNode = None self.inputs = [("Classification Tree", orange.TreeClassifier, self.ctree)] self.outputs = [("Examples", ExampleTable)] #set default settings self.ZoomAutoRefresh = 0 self.AutoArrange = 0 self.ToolTipsEnabled = 1 self.MaxTreeDepth = 5; self.MaxTreeDepthB = 0 self.LineWidth = 5; self.LineWidthMethod = 2 self.NodeSize = 5 self.MaxNodeWidth = 150 self.LimitNodeWidth = True self.NodeInfo = [0, 1] self.Zoom = 5 self.VSpacing = 5; self.HSpacing = 5 self.TruncateText = 1 self.loadSettings() self.NodeInfo.sort() # Changed when the GUI was simplified - added here to override any saved settings self.VSpacing = 1; self.HSpacing = 1 self.ToolTipsEnabled = 1 self.LineWidth = 15 # Also reset when the LineWidthMethod is changed! # GUI definition # self.tabs = OWGUI.tabWidget(self.controlArea) # GENERAL TAB # GeneralTab = OWGUI.createTabPage(self.tabs, "General") # GeneralTab = TreeTab = OWGUI.createTabPage(self.tabs, "Tree") # NodeTab = OWGUI.createTabPage(self.tabs, "Node") GeneralTab = NodeTab = TreeTab = self.controlArea self.infBox = OWGUI.widgetBox(GeneralTab, 'Info', sizePolicy = QSizePolicy(QSizePolicy.Minimum , QSizePolicy.Fixed ), addSpace=True) self.infoa = OWGUI.widgetLabel(self.infBox, 'No tree.') self.infob = OWGUI.widgetLabel(self.infBox, " ") self.sizebox = OWGUI.widgetBox(GeneralTab, "Size", addSpace=True) OWGUI.hSlider(self.sizebox, self, 'Zoom', label='Zoom', minValue=1, maxValue=10, step=1, callback=self.toggleZoomSlider, ticks=1) OWGUI.separator(self.sizebox) cb, sb = OWGUI.checkWithSpin(self.sizebox, self, "Max node width:", 50, 200, "LimitNodeWidth", "MaxNodeWidth", tooltip="Limit the width of tree nodes", checkCallback=self.toggleNodeSize, spinCallback=self.toggleNodeSize, step=10) b = OWGUI.checkBox(OWGUI.indentedBox(self.sizebox, sep=OWGUI.checkButtonOffsetHint(cb)), self, "TruncateText", "Truncate text", callback=self.toggleTruncateText) cb.disables.append(b) cb.makeConsistent() OWGUI.checkWithSpin(self.sizebox, self, 'Max tree depth:', 1, 20, 'MaxTreeDepthB', "MaxTreeDepth", tooltip='Defines the depth of the tree displayed', checkCallback=self.toggleTreeDepth, spinCallback=self.toggleTreeDepth) self.edgebox = OWGUI.widgetBox(GeneralTab, "Edge Widths", addSpace=True) OWGUI.comboBox(self.edgebox, self, 'LineWidthMethod', items=['Equal width', 'Root node', 'Parent node'], callback=self.toggleLineWidth) # Node information grid = QGridLayout() grid.setContentsMargins(*self.controlArea.layout().getContentsMargins()) navButton = OWGUI.button(self.controlArea, self, "Navigator", self.toggleNavigator, debuggingEnabled = 0, addToLayout=False) # findbox = OWGUI.widgetBox(self.controlArea, orientation = "horizontal") self.centerRootButton=OWGUI.button(self.controlArea, self, "Find Root", addToLayout=False, callback=lambda :self.rootNode and \ self.sceneView.centerOn(self.rootNode.x(), self.rootNode.y())) self.centerNodeButton=OWGUI.button(self.controlArea, self, "Find Selected", addToLayout=False, callback=lambda :self.selectedNode and \ self.sceneView.centerOn(self.selectedNode.scenePos())) grid.addWidget(navButton, 0, 0, 1, 2) grid.addWidget(self.centerRootButton, 1, 0) grid.addWidget(self.centerNodeButton, 1, 1) self.leftWidgetPart.layout().insertLayout(1, grid) self.NodeTab=NodeTab self.TreeTab=TreeTab self.GeneralTab=GeneralTab # OWGUI.rubber(NodeTab) self.rootNode=None self.tree=None self.resize(800, 500) self.connect(self.graphButton, SIGNAL("clicked()"), self.saveGraph)
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self,parent,signalManager,"CN2", wantMainArea = 0, resizingEnabled = 0) self.inputs = [("Data", ExampleTable, self.dataset), ("Preprocess", PreprocessedLearner, self.setPreprocessor)] self.outputs = [("Learner", orange.Learner),("Classifier",orange.Classifier),("Unordered CN2 Classifier", orngCN2.CN2UnorderedClassifier)] self.QualityButton = 0 self.CoveringButton = 0 self.Alpha = 0.05 self.stepAlpha = 0.2 self.BeamWidth = 5 self.MinCoverage = 0 self.MaxRuleLength = 0 self.useMaxRuleLength = False self.Weight = 0.9 self.m = 2 self.name = "CN2 rules" self.loadSettings() self.data=None self.preprocessor = None ##GUI labelWidth = 150 self.learnerName = OWGUI.lineEdit(self.controlArea, self, "name", box="Learner/classifier name", tooltip="Name to be used by other widgets to identify the learner/classifier") #self.learnerName.setText(self.name) OWGUI.separator(self.controlArea) self.ruleQualityBG = OWGUI.widgetBox(self.controlArea, "Rule quality estimation") self.ruleQualityBG.buttons = [] OWGUI.separator(self.controlArea) self.ruleValidationGroup = OWGUI.widgetBox(self.controlArea, "Pre-prunning (LRS)") OWGUI.separator(self.controlArea) OWGUI.spin(self.controlArea, self, "BeamWidth", 1, 100, box="Beam width", tooltip="The width of the search beam\n(number of rules to be specialized)") OWGUI.separator(self.controlArea) self.coveringAlgBG = OWGUI.widgetBox(self.controlArea, "Covering algorithm") self.coveringAlgBG.buttons = [] """ self.ruleQualityBG=OWGUI.radioButtonsInBox(self.ruleQualityGroup, self, "QualityButton", btnLabels=["Laplace","m-estimate","WRACC"], box="Rule quality", callback=self.qualityButtonPressed, tooltips=["Laplace rule evaluator", "m-estimate rule evaluator", "WRACC rule evaluator"]) self.mSpin=Spin=OWGUI.spin(self.ruleQualityGroup, self, "m", 0, 100, label="m", orientation="horizontal", labelWidth=labelWidth-100, tooltip="m value for m estimate rule evaluator") """ b1 = QRadioButton("Laplace", self.ruleQualityBG); self.ruleQualityBG.layout().addWidget(b1) g = OWGUI.widgetBox(self.ruleQualityBG, orientation = "horizontal"); b2 = QRadioButton("m-estimate", g) g.layout().addWidget(b2) self.mSpin = OWGUI.doubleSpin(g,self,"m",0,100) b3 = QRadioButton("EVC", self.ruleQualityBG) self.ruleQualityBG.layout().addWidget(b3) b4 = QRadioButton("WRACC", self.ruleQualityBG) self.ruleQualityBG.layout().addWidget(b4) self.ruleQualityBG.buttons = [b1, b2, b3, b4] for i, button in enumerate([b1, b2, b3, b4]): self.connect(button, SIGNAL("clicked()"), lambda v=i: self.qualityButtonPressed(v)) OWGUI.doubleSpin(self.ruleValidationGroup, self, "Alpha", 0, 1,0.001, label="Alpha (vs. default rule)", orientation="horizontal", labelWidth=labelWidth, tooltip="Required significance of the difference between the class distribution on all example and covered examples") OWGUI.doubleSpin(self.ruleValidationGroup, self, "stepAlpha", 0, 1,0.001, label="Stopping Alpha (vs. parent rule)", orientation="horizontal", labelWidth=labelWidth, tooltip="Required significance of each specialization of a rule.") OWGUI.spin(self.ruleValidationGroup, self, "MinCoverage", 0, 100,label="Minimum coverage", orientation="horizontal", labelWidth=labelWidth, tooltip= "Minimum number of examples a rule must\ncover (use 0 for not setting the limit)") OWGUI.checkWithSpin(self.ruleValidationGroup, self, "Maximal rule length", 0, 100, "useMaxRuleLength", "MaxRuleLength", labelWidth=labelWidth, tooltip="Maximal number of conditions in the left\npart of the rule (use 0 for don't care)") """ self.coveringAlgBG=OWGUI.radioButtonsInBox(self.coveringAlgGroup, self, "CoveringButton", btnLabels=["Exclusive covering ","Weighted Covering"], tooltips=["Each example will only be used once\n for the construction of a rule", "Examples can take part in the construction\n of many rules(CN2-SD Algorithm)"], box="Covering algorithm", callback=self.coveringAlgButtonPressed) self.weightSpin=OWGUI.doubleSpin(self.coveringAlgGroup, self, "Weight",0, 0.95,0.05,label= "Weight", orientation="horizontal", labelWidth=labelWidth, tooltip= "Multiplication constant by which the weight of\nthe example will be reduced") """ B1 = QRadioButton("Exclusive covering", self.coveringAlgBG); self.coveringAlgBG.layout().addWidget(B1) g = OWGUI.widgetBox(self.coveringAlgBG, orientation = "horizontal") B2 = QRadioButton("Weighted covering", g); g.layout().addWidget(B2) self.coveringAlgBG.buttons = [B1, B2] self.weightSpin=OWGUI.doubleSpin(g,self,"Weight",0,0.95,0.05) for i, button in enumerate([B1, B2]): self.connect(button, SIGNAL("clicked()"), lambda v=i: self.coveringAlgButtonPressed(v)) OWGUI.separator(self.controlArea) self.btnApply = OWGUI.button(self.controlArea, self, "&Apply", callback=self.applySettings, default=True) self.Alpha=float(self.Alpha) self.stepAlpha=float(self.stepAlpha) self.Weight=float(self.Weight) #self.ruleQualityBG.buttons[self.QualityButton].setChecked(1) self.qualityButtonPressed(self.QualityButton) self.coveringAlgButtonPressed(self.CoveringButton) self.resize(100,100) self.setLearner()
def __init__(self, parent=None, signalManager=None, name='Classification Tree'): OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0, resizingEnabled=0) self.inputs = [("Data", ExampleTable, self.setData), ("Preprocess", PreprocessedLearner, self.setPreprocessor)] self.outputs = [("Learner", orange.TreeLearner), ("Classification Tree", orange.TreeClassifier), ("Classification Tree Graph", Orange.network.Graph)] self.name = 'Classification Tree' self.estim = 0 self.relK = 5 self.relM = 100 self.limitRef = True self.bin = 0 self.subset = 0 self.preLeafInstP = 2 self.preNodeInstP = 5 self.preNodeMajP = 95 self.preLeafInst = 1 self.preNodeInst = 0 self.preNodeMaj = 0 self.postMaj = 1 self.postMPruning = 1 self.postM = 2.0 self.limitDepth = False self.maxDepth = 100 self.loadSettings() self.data = None self.preprocessor = None self.setLearner() OWGUI.lineEdit( self.controlArea, self, 'name', box='Learner/Classifier Name', tooltip= 'Name to be used by other widgets to identify your learner/classifier.' ) OWGUI.separator(self.controlArea) qBox = OWGUI.widgetBox(self.controlArea, 'Attribute selection criterion') self.qMea = OWGUI.comboBox(qBox, self, "estim", items=[m[0] for m in self.measures], callback=self.measureChanged) b1 = OWGUI.widgetBox(qBox, orientation="horizontal") OWGUI.separator(b1, 16, 0) b2 = OWGUI.widgetBox(b1) self.cbLimitRef, self.hbxRel1 = OWGUI.checkWithSpin( b2, self, "Limit the number of reference examples to ", 1, 1000, "limitRef", "relM") OWGUI.separator(b2) self.hbxRel2 = OWGUI.spin(b2, self, "relK", 1, 50, orientation="horizontal", label="Number of neighbours in ReliefF ") OWGUI.separator(self.controlArea) OWGUI.radioButtonsInBox(self.controlArea, self, 'bin', self.binarizationOpts, "Binarization") OWGUI.separator(self.controlArea) self.measureChanged() self.pBox = OWGUI.widgetBox(self.controlArea, 'Pre-Pruning') self.preLeafInstBox, self.preLeafInstPBox = OWGUI.checkWithSpin( self.pBox, self, "Min. instances in leaves ", 1, 1000, "preLeafInst", "preLeafInstP") self.preNodeInstBox, self.preNodeInstPBox = OWGUI.checkWithSpin( self.pBox, self, "Stop splitting nodes with less instances than ", 1, 1000, "preNodeInst", "preNodeInstP") self.preNodeMajBox, self.preNodeMajPBox = OWGUI.checkWithSpin( self.pBox, self, "Stop splitting nodes with a majority class of (%)", 1, 100, "preNodeMaj", "preNodeMajP") self.cbLimitDepth, self.maxDepthBox = OWGUI.checkWithSpin( self.pBox, self, "Stop splitting nodes at depth", 0, 1000, "limitDepth", "maxDepth") OWGUI.separator(self.controlArea) self.mBox = OWGUI.widgetBox(self.controlArea, 'Post-Pruning') OWGUI.checkBox(self.mBox, self, 'postMaj', 'Recursively merge leaves with same majority class') self.postMPruningBox, self.postMPruningPBox = OWGUI.checkWithSpin( self.mBox, self, "Pruning with m-estimate, m=", 0, 1000, 'postMPruning', 'postM') OWGUI.separator(self.controlArea) self.btnApply = OWGUI.button(self.controlArea, self, "&Apply", callback=self.setLearner, disabled=0, default=True) OWGUI.rubber(self.controlArea) self.resize(200, 200)
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "SampleData", wantMainArea=0) self.inputs = [("Data", ExampleTable, self.setData)] self.outputs = [("Data Sample", ExampleTable), ("Remaining Data", ExampleTable)] # initialization of variables self.data = None # dataset (incoming stream) self.indices = None # indices that control sampling self.Stratified = 1 # use stratified sampling if possible? self.Repeat = 0 # can elements repeat in a sample? self.UseSpecificSeed = 0 # use a specific random seed? self.RandomSeed = 1 # specific seed used self.GroupSeed = 1 # current seed for multiple group selection self.outFold = 1 # folder/group to output self.Folds = 1 # total number of folds/groups self.SelectType = 0 # sampling type (LOO, CV, ...) self.useCases = 0 # use a specific number of cases? self.nCases = 25 # number of cases to use self.selPercentage = 30 # sample size in % self.CVFolds = 10 # number of CV folds self.nGroups = 3 # number of groups self.pGroups = [0.1, 0.25, 0.5] # sizes of groups self.GroupText = "0.1,0.25,0.5" # assigned to Groups Control (for internal use) self.autocommit = False # Invalidated settings flag. self.outputInvalidateFlag = False self.loadSettings() # GUI # Info Box box1 = OWGUI.widgetBox(self.controlArea, "Information", addSpace=True) # Input data set info self.infoa = OWGUI.widgetLabel(box1, "No data on input.") # Sampling type/parameters info self.infob = OWGUI.widgetLabel(box1, " ") # Output data set info self.infoc = OWGUI.widgetLabel(box1, " ") # Options Box box2 = OWGUI.widgetBox(self.controlArea, "Options", addSpace=True) OWGUI.checkBox(box2, self, "Stratified", "Stratified (if possible)", callback=self.settingsChanged) OWGUI.checkWithSpin( box2, self, "Set random seed:", 0, 32767, "UseSpecificSeed", "RandomSeed", checkCallback=self.settingsChanged, spinCallback=self.settingsChanged, ) # Sampling Type Box self.s = [None, None, None, None] self.sBox = OWGUI.widgetBox(self.controlArea, "Sampling type", addSpace=True) self.sBox.buttons = [] # Random Sampling self.s[0] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", "Random sampling") # indent indent = OWGUI.checkButtonOffsetHint(self.s[0]) # repeat checkbox self.h1Box = OWGUI.indentedBox(self.sBox, sep=indent, orientation="horizontal") OWGUI.checkBox(self.h1Box, self, "Repeat", "With replacement", callback=self.settingsChanged) # specified number of elements checkbox self.h2Box = OWGUI.indentedBox(self.sBox, sep=indent, orientation="horizontal") check, _ = OWGUI.checkWithSpin( self.h2Box, self, "Sample size (instances):", 1, 1000000000, "useCases", "nCases", checkCallback=self.settingsChanged, spinCallback=self.settingsChanged, ) # percentage slider self.h3Box = OWGUI.indentedBox(self.sBox, sep=indent) OWGUI.widgetLabel(self.h3Box, "Sample size:") self.slidebox = OWGUI.widgetBox(self.h3Box, orientation="horizontal") OWGUI.hSlider( self.slidebox, self, "selPercentage", minValue=1, maxValue=100, step=1, ticks=10, labelFormat=" %d%%", callback=self.settingsChanged, ) # Sample size (instances) check disables the Percentage slider. # TODO: Should be an exclusive option (radio buttons) check.disables.extend([(-1, self.h3Box)]) check.makeConsistent() # Cross Validation sampling options self.s[1] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", "Cross validation") box = OWGUI.indentedBox(self.sBox, sep=indent, orientation="horizontal") OWGUI.spin(box, self, "CVFolds", 2, 100, step=1, label="Number of folds: ", callback=self.settingsChanged) # Leave-One-Out self.s[2] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", "Leave-one-out") # Multiple Groups self.s[3] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", "Multiple subsets") gbox = OWGUI.indentedBox(self.sBox, sep=indent, orientation="horizontal") OWGUI.lineEdit( gbox, self, "GroupText", label='Subset sizes (e.g. "0.1, 0.2, 0.5"):', callback=self.multipleChanged ) # Output Group Box box = OWGUI.widgetBox(self.controlArea, "Output Data for Fold / Group", addSpace=True) self.foldcombo = OWGUI.comboBox( box, self, "outFold", items=range(1, 101), label="Fold / group:", orientation="horizontal", sendSelectedValue=1, valueType=int, callback=self.invalidate, ) self.foldcombo.setEnabled(self.SelectType != 0) # Sample Data box OWGUI.rubber(self.controlArea) box = OWGUI.widgetBox(self.controlArea, "Sample Data") cb = OWGUI.checkBox(box, self, "autocommit", "Sample on any change") self.sampleButton = OWGUI.button(box, self, "Sample &Data", callback=self.sdata, default=True) OWGUI.setStopper(self, self.sampleButton, cb, "outputInvalidateFlag", callback=self.sdata) # set initial radio button on (default sample type) self.s[self.SelectType].setChecked(True) # Connect radio buttons (SelectType) for i, button in enumerate(self.s): button.toggled[bool].connect(lambda state, i=i: self.samplingTypeChanged(state, i)) self.process() self.resize(200, 275)
def __init__(self, visualizationWidget = None, signalManager = None): OWWidget.__init__(self, None, signalManager, "Sieve Evaluation Dialog", savePosition = True, wantMainArea = 0, wantStatusBar = 1) orngMosaic.__init__(self) self.resize(390,620) self.setCaption("Sieve Diagram Evaluation Dialog") # loaded variables self.visualizationWidget = visualizationWidget self.useTimeLimit = 0 self.useProjectionLimit = 0 self.qualityMeasure = CHI_SQUARE # we will always compute only chi square with sieve diagram self.optimizationType = EXACT_NUMBER_OF_ATTRS self.attributeCount = 2 self.attrCondition = None self.attrConditionValue = None self.lastSaveDirName = os.getcwd() self.attrLenDict = {} self.shownResults = [] self.loadSettings() self.layout().setMargin(0) self.tabs = OWGUI.tabWidget(self.controlArea) self.MainTab = OWGUI.createTabPage(self.tabs, "Main") self.SettingsTab = OWGUI.createTabPage(self.tabs, "Settings") self.ManageTab = OWGUI.createTabPage(self.tabs, "Manage") # ########################### # MAIN TAB box = OWGUI.widgetBox(self.MainTab, box = "Condition") self.attrConditionCombo = OWGUI.comboBoxWithCaption(box, self, "attrCondition", "Attribute:", callback = self.updateConditionAttr, sendSelectedValue = 1, valueType = str, labelWidth = 70) self.attrConditionValueCombo = OWGUI.comboBoxWithCaption(box, self, "attrConditionValue", "Value:", sendSelectedValue = 1, valueType = str, labelWidth = 70) self.optimizationBox = OWGUI.widgetBox(self.MainTab, "Evaluate") self.buttonBox = OWGUI.widgetBox(self.optimizationBox, orientation = "horizontal") self.resultsBox = OWGUI.widgetBox(self.MainTab, "Projection List Ordered by Chi-Square") # self.label1 = OWGUI.widgetLabel(self.buttonBox, 'Projections with ') # self.optimizationTypeCombo = OWGUI.comboBox(self.buttonBox, self, "optimizationType", items = [" exactly ", " maximum "] ) # self.attributeCountCombo = OWGUI.comboBox(self.buttonBox, self, "attributeCount", items = range(1, 5), tooltip = "Evaluate only projections with exactly (or maximum) this number of attributes", sendSelectedValue = 1, valueType = int) # self.attributeLabel = OWGUI.widgetLabel(self.buttonBox, ' attributes') self.startOptimizationButton = OWGUI.button(self.optimizationBox, self, "Start Evaluating Projections", callback = self.evaluateProjections) f = self.startOptimizationButton.font(); f.setBold(1); self.startOptimizationButton.setFont(f) self.stopOptimizationButton = OWGUI.button(self.optimizationBox, self, "Stop Evaluation", callback = self.stopEvaluationClick) self.stopOptimizationButton.setFont(f) self.stopOptimizationButton.hide() self.resultList = OWGUI.listBox(self.resultsBox, self, callback = self.showSelectedAttributes) self.resultList.setMinimumHeight(200) # ########################## # SETTINGS TAB OWGUI.checkBox(self.SettingsTab, self, "ignoreTooSmallCells", "Ignore cells where expected number of cases is less than 5", box = "Ignore small cells", tooltip = "Statisticians advise that in cases when the number of expected examples is less than 5 we ignore the cell \nsince it can significantly influence the chi-square value.") OWGUI.comboBoxWithCaption(self.SettingsTab, self, "percentDataUsed", "Percent of data used: ", box = "Data settings", items = self.percentDataNums, sendSelectedValue = 1, valueType = int, tooltip = "In case that we have a large dataset the evaluation of each projection can take a lot of time.\nWe can therefore use only a subset of randomly selected examples, evaluate projection on them and thus make evaluation faster.") self.stopOptimizationBox = OWGUI.widgetBox(self.SettingsTab, "When to Stop Evaluation or Optimization?") OWGUI.checkWithSpin(self.stopOptimizationBox, self, "Time limit: ", 1, 1000, "useTimeLimit", "timeLimit", " (minutes)", debuggingEnabled = 0) # disable debugging. we always set this to 1 minute OWGUI.checkWithSpin(self.stopOptimizationBox, self, "Use projection count limit: ", 1, 1000000, "useProjectionLimit", "projectionLimit", " (projections)", debuggingEnabled = 0) OWGUI.rubber(self.SettingsTab) # ########################## # SAVE TAB # self.visualizedAttributesBox = OWGUI.widgetBox(self.ManageTab, "Number of Concurrently Visualized Attributes") self.dialogsBox = OWGUI.widgetBox(self.ManageTab, "Dialogs") self.manageResultsBox = OWGUI.widgetBox(self.ManageTab, "Manage projections") # self.attrLenList = OWGUI.listBox(self.visualizedAttributesBox, self, selectionMode = QListWidget.MultiSelection, callback = self.attrLenListChanged) # self.attrLenList.setMinimumHeight(60) self.buttonBox7 = OWGUI.widgetBox(self.dialogsBox, orientation = "horizontal") OWGUI.button(self.buttonBox7, self, "Attribute Ranking", self.attributeAnalysis, debuggingEnabled = 0) OWGUI.button(self.buttonBox7, self, "Graph Projection Scores", self.graphProjectionQuality, debuggingEnabled = 0) hbox = OWGUI.widgetBox(self.manageResultsBox, orientation = "horizontal") OWGUI.button(hbox, self, "Load", self.load, debuggingEnabled = 0) OWGUI.button(hbox, self, "Save", self.save, debuggingEnabled = 0) hbox = OWGUI.widgetBox(self.manageResultsBox, orientation = "horizontal") OWGUI.button(hbox, self, "Clear results", self.clearResults) OWGUI.rubber(self.ManageTab) # reset some parameters if we are debugging so that it won't take too much time if orngDebugging.orngDebuggingEnabled: self.useTimeLimit = 1 self.timeLimit = 0.3 self.useProjectionLimit = 1 self.projectionLimit = 100 self.icons = self.createAttributeIconDict()
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "CN2", wantMainArea=0, resizingEnabled=0) self.inputs = [("Example Table", ExampleTable, self.dataset)] self.outputs = [("Learner", orange.Learner), ("Classifier", orange.Classifier), ("Unordered CN2 Classifier", orngCN2.CN2UnorderedClassifier)] self.QualityButton = 0 self.CoveringButton = 0 self.Alpha = 0.05 self.stepAlpha = 0.2 self.BeamWidth = 5 self.MinCoverage = 0 self.MaxRuleLength = 0 self.useMaxRuleLength = False self.Weight = 0.9 self.m = 2 self.name = "CN2 rules" self.loadSettings() self.data = None ##GUI labelWidth = 150 self.learnerName = OWGUI.lineEdit( self.controlArea, self, "name", box="Learner/classifier name", tooltip= "Name to be used by other widgets to identify the learner/classifier" ) #self.learnerName.setText(self.name) OWGUI.separator(self.controlArea) self.ruleQualityBG = OWGUI.widgetBox(self.controlArea, "Rule quality estimation") self.ruleQualityBG.buttons = [] OWGUI.separator(self.controlArea) self.ruleValidationGroup = OWGUI.widgetBox(self.controlArea, "Pre-prunning (LRS)") OWGUI.separator(self.controlArea) OWGUI.spin( self.controlArea, self, "BeamWidth", 1, 100, box="Beam width", tooltip= "The width of the search beam\n(number of rules to be specialized)" ) OWGUI.separator(self.controlArea) self.coveringAlgBG = OWGUI.widgetBox(self.controlArea, "Covering algorithm") self.coveringAlgBG.buttons = [] """ self.ruleQualityBG=OWGUI.radioButtonsInBox(self.ruleQualityGroup, self, "QualityButton", btnLabels=["Laplace","m-estimate","WRACC"], box="Rule quality", callback=self.qualityButtonPressed, tooltips=["Laplace rule evaluator", "m-estimate rule evaluator", "WRACC rule evaluator"]) self.mSpin=Spin=OWGUI.spin(self.ruleQualityGroup, self, "m", 0, 100, label="m", orientation="horizontal", labelWidth=labelWidth-100, tooltip="m value for m estimate rule evaluator") """ b1 = QRadioButton("Laplace", self.ruleQualityBG) self.ruleQualityBG.layout().addWidget(b1) g = OWGUI.widgetBox(self.ruleQualityBG, orientation="horizontal") b2 = QRadioButton("m-estimate", g) g.layout().addWidget(b2) self.mSpin = OWGUI.doubleSpin(g, self, "m", 0, 100) b3 = QRadioButton("WRACC", self.ruleQualityBG) self.ruleQualityBG.layout().addWidget(b3) self.ruleQualityBG.buttons = [b1, b2, b3] for i, button in enumerate([b1, b2, b3]): self.connect(button, SIGNAL("clicked()"), lambda v=i: self.qualityButtonPressed(v)) OWGUI.doubleSpin( self.ruleValidationGroup, self, "Alpha", 0, 1, 0.001, label="Alpha (vs. default rule)", orientation="horizontal", labelWidth=labelWidth, tooltip= "Required significance of the difference between the class distribution on all example and covered examples" ) OWGUI.doubleSpin( self.ruleValidationGroup, self, "stepAlpha", 0, 1, 0.001, label="Stopping Alpha (vs. parent rule)", orientation="horizontal", labelWidth=labelWidth, tooltip="Required significance of each specialization of a rule.") OWGUI.spin( self.ruleValidationGroup, self, "MinCoverage", 0, 100, label="Minimum coverage", orientation="horizontal", labelWidth=labelWidth, tooltip= "Minimum number of examples a rule must\ncover (use 0 for not setting the limit)" ) OWGUI.checkWithSpin( self.ruleValidationGroup, self, "Maximal rule length", 0, 100, "useMaxRuleLength", "MaxRuleLength", labelWidth=labelWidth, tooltip= "Maximal number of conditions in the left\npart of the rule (use 0 for don't care)" ) """ self.coveringAlgBG=OWGUI.radioButtonsInBox(self.coveringAlgGroup, self, "CoveringButton", btnLabels=["Exclusive covering ","Weighted Covering"], tooltips=["Each example will only be used once\n for the construction of a rule", "Examples can take part in the construction\n of many rules(CN2-SD Algorithm)"], box="Covering algorithm", callback=self.coveringAlgButtonPressed) self.weightSpin=OWGUI.doubleSpin(self.coveringAlgGroup, self, "Weight",0, 0.95,0.05,label= "Weight", orientation="horizontal", labelWidth=labelWidth, tooltip= "Multiplication constant by which the weight of\nthe example will be reduced") """ B1 = QRadioButton("Exclusive covering", self.coveringAlgBG) self.coveringAlgBG.layout().addWidget(B1) g = OWGUI.widgetBox(self.coveringAlgBG, orientation="horizontal") B2 = QRadioButton("Weighted covering", g) g.layout().addWidget(B2) self.coveringAlgBG.buttons = [B1, B2] self.weightSpin = OWGUI.doubleSpin(g, self, "Weight", 0, 0.95, 0.05) for i, button in enumerate([B1, B2]): self.connect(button, SIGNAL("clicked()"), lambda v=i: self.coveringAlgButtonPressed(v)) OWGUI.separator(self.controlArea) self.btnApply = OWGUI.button(self.controlArea, self, "&Apply", callback=self.applySettings) self.Alpha = float(self.Alpha) self.stepAlpha = float(self.stepAlpha) self.Weight = float(self.Weight) #self.ruleQualityBG.buttons[self.QualityButton].setChecked(1) self.qualityButtonPressed(self.QualityButton) self.coveringAlgButtonPressed(self.CoveringButton) self.resize(100, 100) self.setLearner()
def __init__(self, parent=None, signalManager=None, name="Logistic regression"): OWWidget.__init__(self, parent, signalManager, name, wantMainArea=0, resizingEnabled=0) self.inputs = [("Data", ExampleTable, self.setData), ("Preprocess", PreprocessedLearner, self.setPreprocessor)] self.outputs = [("Learner", orange.Learner), ("Classifier", orange.Classifier), ("Features", list)] from orngTree import TreeLearner imputeByModel = orange.ImputerConstructor_model() imputeByModel.learnerDiscrete = TreeLearner(measure="infoGain", minSubset=50) imputeByModel.learnerContinuous = TreeLearner(measure="retis", minSubset=50) self.imputationMethods = [ imputeByModel, orange.ImputerConstructor_average(), orange.ImputerConstructor_minimal(), orange.ImputerConstructor_maximal(), None ] self.imputationMethodsStr = [ "Classification/Regression trees", "Average values", "Minimal value", "Maximal value", "None (skip examples)" ] self.name = "Logistic regression" self.univariate = 0 self.stepwiseLR = 0 self.addCrit = 10 self.removeCrit = 10 self.numAttr = 10 self.limitNumAttr = False self.zeroPoint = 0 self.imputation = 1 self.data = None self.preprocessor = None self.loadSettings() OWGUI.lineEdit( self.controlArea, self, 'name', box='Learner/Classifier Name', tooltip= 'Name to be used by other widgets to identify your learner/classifier.' ) OWGUI.separator(self.controlArea) box = OWGUI.widgetBox(self.controlArea, "Attribute selection") stepwiseCb = OWGUI.checkBox(box, self, "stepwiseLR", "Stepwise attribute selection") ibox = OWGUI.indentedBox(box, sep=OWGUI.checkButtonOffsetHint(stepwiseCb)) addCritSpin = OWGUI.spin( ibox, self, "addCrit", 1, 50, label="Add threshold [%]", labelWidth=155, tooltip="Requested significance for adding an attribute") remCritSpin = OWGUI.spin( ibox, self, "removeCrit", 1, 50, label="Remove threshold [%]", labelWidth=155, tooltip="Requested significance for removing an attribute") limitAttSpin = OWGUI.checkWithSpin( ibox, self, "Limit number of attributes to ", 1, 100, "limitNumAttr", "numAttr", step=1, labelWidth=155, tooltip= "Maximum number of attributes. Algorithm stops when it selects specified number of attributes." ) stepwiseCb.disables += [addCritSpin, remCritSpin, limitAttSpin] stepwiseCb.makeConsistent() OWGUI.separator(self.controlArea) self.imputationCombo = OWGUI.comboBox( self.controlArea, self, "imputation", box="Imputation of unknown values", items=self.imputationMethodsStr) OWGUI.separator(self.controlArea) applyButton = OWGUI.button(self.controlArea, self, "&Apply", callback=self.applyLearner, default=True) OWGUI.rubber(self.controlArea) #self.adjustSize() self.applyLearner()
def __init__(self,parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "Nomogram", 1) #self.setWFlags(Qt.WResizeNoErase | Qt.WRepaintNoErase) #this works like magic.. no flicker during repaint! self.parent = parent # self.setWFlags(self.getWFlags()+Qt.WStyle_Maximize) self.callbackDeposit = [] # deposit for OWGUI callback functions self.alignType = 0 self.contType = 0 self.yAxis = 0 self.probability = 0 self.verticalSpacing = 60 self.verticalSpacingContinuous = 100 self.diff_between_ordinal = 30 self.fontSize = 9 self.lineWidth = 1 self.histogram = 0 self.histogram_size = 10 self.data = None self.cl = None self.confidence_check = 0 self.confidence_percent = 95 self.sort_type = 0 self.loadSettings() self.pointsName = ["Total", "Total"] self.totalPointsName = ["Probability", "Probability"] self.bnomogram = None self.inputs=[("Classifier", orange.Classifier, self.classifier)] self.TargetClassIndex = 0 self.targetCombo = OWGUI.comboBox(self.controlArea, self, "TargetClassIndex", " Target Class ", addSpace=True, tooltip='Select target (prediction) class in the model.', callback = self.setTarget) self.alignRadio = OWGUI.radioButtonsInBox(self.controlArea, self, 'alignType', ['Align left', 'Align by zero influence'], box='Attribute placement', tooltips=['Attributes in nomogram are left aligned', 'Attributes are not aligned, top scale represents true (normalized) regression coefficient value'], addSpace=True, callback=self.showNomogram) self.verticalSpacingLabel = OWGUI.spin(self.alignRadio, self, 'verticalSpacing', 15, 200, label = 'Vertical spacing:', orientation = 0, tooltip='Define space (pixels) between adjacent attributes.', callback = self.showNomogram) self.ContRadio = OWGUI.radioButtonsInBox(self.controlArea, self, 'contType', ['1D projection', '2D curve'], 'Continuous attributes', tooltips=['Continuous attribute are presented on a single scale', 'Two dimensional space is used to present continuous attributes in nomogram.'], addSpace=True, callback=[lambda:self.verticalSpacingContLabel.setDisabled(not self.contType), self.showNomogram]) self.verticalSpacingContLabel = OWGUI.spin(OWGUI.indentedBox(self.ContRadio, sep=OWGUI.checkButtonOffsetHint(self.ContRadio.buttons[-1])), self, 'verticalSpacingContinuous', 15, 200, label = "Height", orientation=0, tooltip='Define space (pixels) between adjacent 2d presentation of attributes.', callback = self.showNomogram) self.verticalSpacingContLabel.setDisabled(not self.contType) self.yAxisRadio = OWGUI.radioButtonsInBox(self.controlArea, self, 'yAxis', ['Point scale', 'Log odds ratios'], 'Scale', tooltips=['values are normalized on a 0-100 point scale','values on top axis show log-linear contribution of attribute to full model'], addSpace=True, callback=self.showNomogram) layoutBox = OWGUI.widgetBox(self.controlArea, "Display", orientation=1, addSpace=True) self.probabilityCheck = OWGUI.checkBox(layoutBox, self, 'probability', 'Show prediction', tooltip='', callback = self.setProbability) self.CICheck, self.CILabel = OWGUI.checkWithSpin(layoutBox, self, 'Confidence intervals (%):', min=1, max=99, step = 1, checked='confidence_check', value='confidence_percent', checkCallback=self.showNomogram, spinCallback = self.showNomogram) self.histogramCheck, self.histogramLabel = OWGUI.checkWithSpin(layoutBox, self, 'Show histogram, size', min=1, max=30, checked='histogram', value='histogram_size', step = 1, tooltip='-(TODO)-', checkCallback=self.showNomogram, spinCallback = self.showNomogram) OWGUI.separator(layoutBox) self.sortOptions = ["No sorting", "Absolute importance", "Positive influence", "Negative influence"] self.sortBox = OWGUI.comboBox(layoutBox, self, "sort_type", label="Sort by ", items=self.sortOptions, callback = self.sortNomogram, orientation="horizontal") OWGUI.rubber(self.controlArea) self.connect(self.graphButton, SIGNAL("clicked()"), self.menuItemPrinter) #add a graph widget self.header = OWNomogramHeader(None, self.mainArea) self.header.setFixedHeight(60) self.header.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.header.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.graph = OWNomogramGraph(self.bnomogram, self.mainArea) self.graph.setMinimumWidth(200) self.graph.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.footer = OWNomogramHeader(None, self.mainArea) self.footer.setFixedHeight(60*2+10) self.footer.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.footer.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.mainArea.layout().addWidget(self.header) self.mainArea.layout().addWidget(self.graph) self.mainArea.layout().addWidget(self.footer) self.resize(700,500) #self.repaint() #self.update() # mouse pressed flag self.mousepr = False
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, "Nomogram", 1) #self.setWFlags(Qt.WResizeNoErase | Qt.WRepaintNoErase) #this works like magic.. no flicker during repaint! self.parent = parent # self.setWFlags(self.getWFlags()+Qt.WStyle_Maximize) self.callbackDeposit = [] # deposit for OWGUI callback functions self.alignType = 0 self.contType = 0 self.yAxis = 0 self.probability = 0 self.verticalSpacing = 60 self.verticalSpacingContinuous = 100 self.diff_between_ordinal = 30 self.fontSize = 9 self.lineWidth = 1 self.histogram = 0 self.histogram_size = 10 self.data = None self.cl = None self.confidence_check = 0 self.confidence_percent = 95 self.sort_type = 0 self.loadSettings() self.pointsName = ["Total", "Total"] self.totalPointsName = ["Probability", "Probability"] self.bnomogram = None self.inputs = [("Classifier", orange.Classifier, self.classifier)] self.TargetClassIndex = 0 self.targetCombo = OWGUI.comboBox( self.controlArea, self, "TargetClassIndex", " Target Class ", addSpace=True, tooltip='Select target (prediction) class in the model.', callback=self.setTarget) self.alignRadio = OWGUI.radioButtonsInBox( self.controlArea, self, 'alignType', ['Align left', 'Align by zero influence'], box='Attribute placement', tooltips=[ 'Attributes in nomogram are left aligned', 'Attributes are not aligned, top scale represents true (normalized) regression coefficient value' ], addSpace=True, callback=self.showNomogram) self.verticalSpacingLabel = OWGUI.spin( self.alignRadio, self, 'verticalSpacing', 15, 200, label='Vertical spacing:', orientation=0, tooltip='Define space (pixels) between adjacent attributes.', callback=self.showNomogram) self.ContRadio = OWGUI.radioButtonsInBox( self.controlArea, self, 'contType', ['1D projection', '2D curve'], 'Continuous attributes', tooltips=[ 'Continuous attribute are presented on a single scale', 'Two dimensional space is used to present continuous attributes in nomogram.' ], addSpace=True, callback=[ lambda: self.verticalSpacingContLabel.setDisabled( not self.contType), self.showNomogram ]) self.verticalSpacingContLabel = OWGUI.spin( OWGUI.indentedBox(self.ContRadio, sep=OWGUI.checkButtonOffsetHint( self.ContRadio.buttons[-1])), self, 'verticalSpacingContinuous', 15, 200, label="Height", orientation=0, tooltip= 'Define space (pixels) between adjacent 2d presentation of attributes.', callback=self.showNomogram) self.verticalSpacingContLabel.setDisabled(not self.contType) self.yAxisRadio = OWGUI.radioButtonsInBox( self.controlArea, self, 'yAxis', ['Point scale', 'Log odds ratios'], 'Scale', tooltips=[ 'values are normalized on a 0-100 point scale', 'values on top axis show log-linear contribution of attribute to full model' ], addSpace=True, callback=self.showNomogram) layoutBox = OWGUI.widgetBox(self.controlArea, "Display", orientation=1, addSpace=True) self.probabilityCheck = OWGUI.checkBox(layoutBox, self, 'probability', 'Show prediction', tooltip='', callback=self.setProbability) self.CICheck, self.CILabel = OWGUI.checkWithSpin( layoutBox, self, 'Confidence intervals (%):', min=1, max=99, step=1, checked='confidence_check', value='confidence_percent', checkCallback=self.showNomogram, spinCallback=self.showNomogram) self.histogramCheck, self.histogramLabel = OWGUI.checkWithSpin( layoutBox, self, 'Show histogram, size', min=1, max=30, checked='histogram', value='histogram_size', step=1, tooltip='-(TODO)-', checkCallback=self.showNomogram, spinCallback=self.showNomogram) OWGUI.separator(layoutBox) self.sortOptions = [ "No sorting", "Absolute importance", "Positive influence", "Negative influence" ] self.sortBox = OWGUI.comboBox(layoutBox, self, "sort_type", label="Sort by ", items=self.sortOptions, callback=self.sortNomogram, orientation="horizontal") OWGUI.rubber(self.controlArea) self.connect(self.graphButton, SIGNAL("clicked()"), self.menuItemPrinter) #add a graph widget self.header = OWNomogramHeader(None, self.mainArea) self.header.setFixedHeight(self.verticalSpacing) self.header.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.header.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.graph = OWNomogramGraph(self.bnomogram, self.mainArea) self.graph.setMinimumWidth(200) self.graph.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.footer = OWNomogramHeader(None, self.mainArea) self.footer.setFixedHeight(self.verticalSpacing * 2 + 10) self.footer.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.footer.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.mainArea.layout().addWidget(self.header) self.mainArea.layout().addWidget(self.graph) self.mainArea.layout().addWidget(self.footer) self.resize(700, 500) #self.repaint() #self.update() # mouse pressed flag self.mousepr = False
def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, 'SampleData', wantMainArea = 0) self.inputs = [("Data", ExampleTable, self.setData)] self.outputs = [("Sample", ExampleTable), ("Remaining Examples", ExampleTable)] # initialization of variables self.data = None # dataset (incoming stream) self.indices = None # indices that control sampling self.ind = None # indices that control sampling self.Stratified = 1 # use stratified sampling if possible? self.Repeat = 0 # can elements repeat in a sample? self.UseSpecificSeed = 0 # use a specific random seed? self.RandomSeed = 1 # specific seed used self.GroupSeed = 1 # current seed for multiple group selection self.outFold = 1 # folder/group to output self.Folds = 1 # total number of folds/groups self.SelectType = 0 # sampling type (LOO, CV, ...) self.useCases = 0 # use a specific number of cases? self.nCases = 25 # number of cases to use self.selPercentage = 30 # sample size in % self.LOO = 1 # use LOO? self.CVFolds = 10 # number of CV folds self.CVFoldsInternal = 10 # number of CV folds (for internal use) self.nGroups = 3 # number of groups self.pGroups = [0.1,0.25,0.5] # sizes of groups self.GroupText = '0.1,0.25,0.5' # assigned to Groups Control (for internal use) self.loadSettings() # GUI # Info Box box1 = OWGUI.widgetBox(self.controlArea, "Information") self.infoa = OWGUI.widgetLabel(box1, 'No data on input.') self.infob = OWGUI.widgetLabel(box1, ' ') self.infoc = OWGUI.widgetLabel(box1, ' ') # Options Box box2 = OWGUI.widgetBox(self.controlArea, 'Options') OWGUI.checkBox(box2, self, 'Stratified', 'Stratified (if possible)', callback=self.settingsChanged) OWGUI.checkWithSpin(box2, self, 'Set random seed:', 0, 32767, 'UseSpecificSeed', 'RandomSeed', checkCallback=self.settingsChanged, spinCallback=self.settingsChanged) OWGUI.separator(self.controlArea) # Sampling Type Box self.s = [None, None, None, None] self.sBox = OWGUI.widgetBox(self.controlArea, "Sampling type") self.sBox.buttons = [] # Random Sampling self.s[0] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", 'Random sampling') # repeat checkbox self.h1Box = OWGUI.indentedBox(self.sBox, orientation = "horizontal") OWGUI.checkBox(self.h1Box, self, 'Repeat', 'With replacement', callback=self.settingsChanged) # specified number of elements checkbox self.h2Box = OWGUI.indentedBox(self.sBox, orientation = "horizontal") OWGUI.checkWithSpin(self.h2Box, self, 'Sample size (instances):', 1, 1000000000, 'useCases', 'nCases', checkCallback=[self.uCases, self.settingsChanged], spinCallback=self.settingsChanged) OWGUI.rubber(self.h2Box) # percentage slider self.h3Box = OWGUI.indentedBox(self.sBox, orientation = "horizontal") OWGUI.widgetLabel(self.h3Box, "Sample size:") self.slidebox = OWGUI.indentedBox(self.sBox, orientation = "horizontal") OWGUI.hSlider(self.slidebox, self, 'selPercentage', minValue=1, maxValue=100, step=1, ticks=10, labelFormat=" %d%%", callback=self.settingsChanged) # Cross Validation self.s[1] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", 'Cross validation') box = OWGUI.indentedBox(self.sBox, orientation = "horizontal") OWGUI.spin(box, self, 'CVFolds', 2, 100, step=1, label='Number of folds: ', callback=[self.changeCombo, self.settingsChanged]) OWGUI.rubber(box) # Leave-One-Out self.s[2] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", 'Leave-one-out') # Multiple Groups self.s[3] = OWGUI.appendRadioButton(self.sBox, self, "SelectType", 'Multiple subsets') gbox = OWGUI.indentedBox(self.sBox, orientation = "horizontal") OWGUI.lineEdit(gbox, self, 'GroupText', label='Subset sizes (e.g. "0.1, 0.2, 0.5"):', callback=self.multipleChanged) # Output Group Box OWGUI.separator(self.controlArea) self.foldcombo = OWGUI.comboBox(self.controlArea, self, "outFold", 'Output Data for Fold / Group', 'Fold / group:', orientation = "horizontal", items = range(1,101), callback = self.foldChanged, sendSelectedValue = 1, valueType = int) self.foldcombo.setEnabled(False) # Select Data Button OWGUI.separator(self.controlArea) self.sampleButton = OWGUI.button(self.controlArea, self, 'Sample &Data', callback = self.process) self.s[self.SelectType].setChecked(True) # set initial radio button on (default sample type) OWGUI.separator(self.controlArea) # CONNECTIONS # set connections for RadioButton (SelectType) self.dummy1 = [None]*len(self.s) for i in range(len(self.s)): self.dummy1[i] = lambda x, v=i: self.sChanged(x, v) self.connect(self.s[i], SIGNAL("toggled(bool)"), self.dummy1[i]) # final touch self.resize(200, 275)
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()