rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
def __init__(self,coeff,estdomain,estimator,flip): | def __init__(self,coeff,estdomain,estimator): | def __init__(self,coeff,estdomain,estimator,flip): self.coeff = coeff self.estdomain = estdomain self.cv = self.estdomain.classVar(0) self.estimator = estimator self.flip = flip |
self.flip = flip | def __init__(self,coeff,estdomain,estimator,flip): self.coeff = coeff self.estdomain = estdomain self.cv = self.estdomain.classVar(0) self.estimator = estimator self.flip = flip | |
if self.flip: ex = orange.Example(self.estdomain,[r*self.coeff,self.cv]) else: ex = orange.Example(self.estdomain,[-r*self.coeff,self.cv]) | ex = orange.Example(self.estdomain,[r*self.coeff,self.cv]) | def __call__(self, r): # got a margin if self.flip: ex = orange.Example(self.estdomain,[r*self.coeff,self.cv]) # need a dummy class value else: ex = orange.Example(self.estdomain,[-r*self.coeff,self.cv]) # need a dummy class value p = self.estimator(ex,orange.GetProbabilities) return p[1] |
(beta, coeffs, coeff_names, basis, m, _probfunc, flip) = self.parser(classifier.classifier,examples, buckets) return (beta, coeffs, coeff_names, basis, m, _marginConverter(self.marginc.coeff, self.marginc.estdomain, self.marginc.estimator, flip), 0) | (beta, coeffs, coeff_names, basis, m, _probfunc) = self.parser(classifier.classifier,examples, buckets) return (beta, coeffs, coeff_names, basis, m, _marginConverter(self.marginc.coeff, self.marginc.estdomain, self.marginc.estimator)) | def __call__(self,classifier,examples, buckets): (beta, coeffs, coeff_names, basis, m, _probfunc, flip) = self.parser(classifier.classifier,examples, buckets) return (beta, coeffs, coeff_names, basis, m, _marginConverter(self.marginc.coeff, self.marginc.estdomain, self.marginc.estimator, flip), 0) |
(beta, coeffs, coeff_names, basis, m, probfunc, flip) = parser(classifier,examples, buckets) | (beta, coeffs, coeff_names, basis, m, probfunc) = parser(classifier,examples, buckets) | def __init__(self, examples, classifier, dimensions = 2, buckets = 3, getpies = 0, getexamples = 1): # error detection if len(examples.domain.classVar.values) != 2: raise "The domain does not have a binary class. Binary class is required." |
self.clusterDlg = ClusterOptimization(self, self.signalManager, self.graph, name) self.graph.clusterOptimization = self.clusterDlg self.freeVizDlg = FreeVizOptimization(self, self.signalManager, self.graph, name) if name.lower() == "radviz": self.optimizationDlg = OWVizRank(self, self.signalManager, self.graph, orn... | def __init__(self,parent=None, signalManager = None, name = "Linear Projection"): OWWidget.__init__(self, parent, signalManager, name, TRUE) | |
self.clusterDlg = ClusterOptimization(self, self.signalManager, self.graph, name) self.graph.clusterOptimization = self.clusterDlg self.freeVizDlg = FreeVizOptimization(self, self.signalManager, self.graph, name) if name.lower() == "radviz": self.optimizationDlg = OWVizRank(self, self.signalManager, self.graph, orn... | def __init__(self,parent=None, signalManager = None, name = "Linear Projection"): OWWidget.__init__(self, parent, signalManager, name, TRUE) | |
OWGUI.comboBoxWithCaption(box2a, self, "valueScalingType", 'Scale values by: ', callback = self.setValueScaling, items = ["attribute range", "global range", "attribute variance"]) | valueScalingList = ["attribute range", "global range", "attribute variance"] if name.lower() == "radviz": valueScalingList.pop(); self.valueScalingType = min(self.valueScalingType, 1) OWGUI.comboBoxWithCaption(box2a, self, "valueScalingType", 'Scale values by: ', callback = self.setValueScaling, items = valueScalingLis... | def __init__(self,parent=None, signalManager = None, name = "Linear Projection"): OWWidget.__init__(self, parent, signalManager, name, TRUE) |
if data.domain.classVar: | if data.domain.classVar and (data.domain.classVar.name, data.domain.classVar.varType) not in shown: | def setShownAttributeList(self, data, shownAttributes = None): shown = [] hidden = [] |
cannotMove = not self.shownAttributes or len(self.selectedShown) != 1 self.buttonUPAttr.setDisabled(cannotMove or not self.selectedShown[0]) self.buttonDOWNAttr.setDisabled(cannotMove or self.selectedShown[0] >= len(self.shownAttributes)-1) | if self.selectedShown: mini, maxi = min(self.selectedShown), max(self.selectedShown) tightSelection = maxi - mini == len(self.selectedShown) - 1 self.buttonUPAttr.setEnabled(self.selectedShown != [] and tightSelection and mini) self.buttonDOWNAttr.setEnabled(self.selectedShown != [] and tightSelection and maxi < len(se... | def resetAttrManipulation(self): cannotMove = not self.shownAttributes or len(self.selectedShown) != 1 self.buttonUPAttr.setDisabled(cannotMove or not self.selectedShown[0]) self.buttonDOWNAttr.setDisabled(cannotMove or self.selectedShown[0] >= len(self.shownAttributes)-1) self.attrAddButton.setDisabled(not self.select... |
def moveAttrUP(self): | def moveAttrSelection(self, labels, selection, dir): | def resetAttrManipulation(self): cannotMove = not self.shownAttributes or len(self.selectedShown) != 1 self.buttonUPAttr.setDisabled(cannotMove or not self.selectedShown[0]) self.buttonDOWNAttr.setDisabled(cannotMove or self.selectedShown[0] >= len(self.shownAttributes)-1) self.attrAddButton.setDisabled(not self.select... |
selected = self.selectedShown[0] if selected: self.shownAttributes = self.shownAttributes[:selected-1] + [self.shownAttributes[selected], self.shownAttributes[selected-1]] + self.shownAttributes[selected+1:] self.selectedShown[0] -= 1 | labs = getattr(self, labels) sel = getattr(self, selection) mini, maxi = min(sel), max(sel)+1 if dir == -1: setattr(self, labels, labs[:mini-1] + labs[mini:maxi] + [labs[mini-1]] + labs[maxi:]) else: setattr(self, labels, labs[:mini] + [labs[maxi]] + labs[mini:maxi] + labs[maxi+1:]) setattr(self, selection, map(lambda ... | def moveAttrUP(self): self.graph.insideColors = None self.graph.clusterClosure = None |
self.graph.insideColors = None; self.graph.clusterClosure = None selected = self.selectedShown[0] if selected < len(self.shownAttributes) - 1: self.shownAttributes = self.shownAttributes[:selected] + [self.shownAttributes[selected+1], self.shownAttributes[selected]] + self.shownAttributes[selected+2:] self.selectedSho... | self.moveAttrSelection("shownAttributes", "selectedShown", 1) | def moveAttrDOWN(self): self.graph.insideColors = None; self.graph.clusterClosure = None |
if self.data and self.data.domain.classVar: self.shownAttributes = self.shownAttributes + self.hiddenAttributes[:-1] self.hiddenAttributes = [self.hiddenAttributes[-1]] | if self.data: self.setShownAttributeList(self.data, [attr.name for attr in self.data.domain.attributes]) | def addAttribute(self, addAll = False): self.graph.insideColors = None self.graph.clusterClosure = None |
self.argumentCountIndex = 1 | self.argumentCount = 1 | def __init__(self, parentWidget = None, signalManager = None, graph = None, parentName = "Visualization widget"): OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog") |
self.argumentCountEdit = OWGUI.comboBoxWithCaption(projCountBox, self, "argumentCountIndex", "Number of projections used when classifying: ", tooltip = "What is the maximum number of projections (arguments) that will be used when classifying an example.", items = [str(x) for x in self.argumentCounts]) | self.argumentCountEdit = OWGUI.comboBoxWithCaption(projCountBox, self, "argumentCount", "Number of projections used when classifying: ", tooltip = "What is the maximum number of projections (arguments) that will be used when classifying an example.", items = self.argumentCounts, sendSelectedValue = 1, va... | def __init__(self, parentWidget = None, signalManager = None, graph = None, parentName = "Visualization widget"): OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog") |
strTotal = createStringFromNumber(len(results)) | strTotal = OWVisFuncts.createStringFromNumber(len(results)) | def reevaluateAllProjections(self): results = list(self.getShownResults()) self.clearResults() |
self.setStatusBarText("Reevaluated %s/%s projections..." % (createStringFromNumber(testIndex), strTotal)) | self.setStatusBarText("Reevaluated %s/%s projections..." % (OWVisFuncts.createStringFromNumber(testIndex), strTotal)) | def reevaluateAllProjections(self): results = list(self.getShownResults()) self.clearResults() |
testExample = [scaleFunction(example, i) for i in range(len(example.domain.attributes))] | testExample = ["?"] * len(example.domain.attributes) | def findArguments(self, selectBest = 1, showClassification = 1, example = None): self.cancelArgumentation = 0 self.clearArguments() self.arguments = [[] for i in range(self.classValueList.count())] snapshots = self.createSnapshots if not example and self.subsetdata == None: QMessageBox.information( None, "VizRank Argu... |
argumentCount = self.argumentCounts[self.argumentCountIndex] | def findArguments(self, selectBest = 1, showClassification = 1, example = None): self.cancelArgumentation = 0 self.clearArguments() self.arguments = [[] for i in range(self.classValueList.count())] snapshots = self.createSnapshots if not example and self.subsetdata == None: QMessageBox.information( None, "VizRank Argu... | |
attrVals = [testExample[self.graph.attributeNameIndex[attrList[i]]] for i in range(len(attrList))] if "?" in attrVals: print "Warning: OWkNNOptimization.py:findArguments: Tested example has a missing value at one of the visualized attributes. Skipping the projection." | validExample = 1 for attr in attrList: if example[attr].isSpecial(): validExample = 0 continue if not validExample: self.printVerbose("Warning: OWkNNOptimization.py:findArguments: Tested example has a missing value at one of the visualized attributes. Skipping the projection.") | def findArguments(self, selectBest = 1, showClassification = 1, example = None): self.cancelArgumentation = 0 self.clearArguments() self.arguments = [[] for i in range(self.classValueList.count())] snapshots = self.createSnapshots if not example and self.subsetdata == None: QMessageBox.information( None, "VizRank Argu... |
print "Warning: OWkNNOptimization.py:findArguments: Scaled example value out of 0-1 range. Min value: %.3f, max value: %.3f." % (min(attrVals), max(attrVals)) | self.printVerbose("Warning: OWkNNOptimization.py:findArguments: Scaled example value out of 0-1 range. Min value: %.3f, max value: %.3f." % (min(attrVals), max(attrVals))) | def findArguments(self, selectBest = 1, showClassification = 1, example = None): self.cancelArgumentation = 0 self.clearArguments() self.arguments = [[] for i in range(self.classValueList.count())] snapshots = self.createSnapshots if not example and self.subsetdata == None: QMessageBox.information( None, "VizRank Argu... |
if self.externalLearner: learner = self.externalLearner else: learner = self.learner | learner = self.externalLearner or self.learner | def findArguments(self, selectBest = 1, showClassification = 1, example = None): self.cancelArgumentation = 0 self.clearArguments() self.arguments = [[] for i in range(self.classValueList.count())] snapshots = self.createSnapshots if not example and self.subsetdata == None: QMessageBox.information( None, "VizRank Argu... |
if index > argumentCount: self.cancelArgumentation = 1 | if index >= self.argumentCount-1: self.cancelArgumentation = 1 | def findArguments(self, selectBest = 1, showClassification = 1, example = None): self.cancelArgumentation = 0 self.clearArguments() self.arguments = [[] for i in range(self.classValueList.count())] snapshots = self.createSnapshots if not example and self.subsetdata == None: QMessageBox.information( None, "VizRank Argu... |
self.parentWidget.updateGraph(attrList) | if self.parentName == "Radviz": self.parentWidget.updateGraph(attrList, setAnchors = 1) else: self.parentWidget.updateGraph(attrList) | def findArguments(self, selectBest = 1, showClassification = 1, example = None): self.cancelArgumentation = 0 self.clearArguments() self.arguments = [[] for i in range(self.classValueList.count())] snapshots = self.createSnapshots if not example and self.subsetdata == None: QMessageBox.information( None, "VizRank Argu... |
for i in range(min(argumentCount, len(argumentList))): | for i in range(min(self.argumentCount, len(argumentList))): | def findArguments(self, selectBest = 1, showClassification = 1, example = None): self.cancelArgumentation = 0 self.clearArguments() self.arguments = [[] for i in range(self.classValueList.count())] snapshots = self.createSnapshots if not example and self.subsetdata == None: QMessageBox.information( None, "VizRank Argu... |
for i in range(argumentCount, min(argumentCount + 100, len(self.shownResults))): | for i in range(self.argumentCount, min(self.argumentCount + 100, len(self.shownResults))): | def findArguments(self, selectBest = 1, showClassification = 1, example = None): self.cancelArgumentation = 0 self.clearArguments() self.arguments = [[] for i in range(self.classValueList.count())] snapshots = self.createSnapshots if not example and self.subsetdata == None: QMessageBox.information( None, "VizRank Argu... |
if foundArguments > argumentCount: s += "<nobr>Note: To get the current prediction, <b>%d</b> arguments had to be used (instead of %d)<br>" % (foundArguments, argumentCount) | if foundArguments > self.argumentCount: s += "<nobr>Note: To get the current prediction, <b>%d</b> arguments had to be used (instead of %d)<br>" % (foundArguments, self.argumentCount) | def findArguments(self, selectBest = 1, showClassification = 1, example = None): self.cancelArgumentation = 0 self.clearArguments() self.arguments = [[] for i in range(self.classValueList.count())] snapshots = self.createSnapshots if not example and self.subsetdata == None: QMessageBox.information( None, "VizRank Argu... |
self.parentWidget.updateGraph(self.arguments[classInd][ind][5]) | if self.parentName == "Radviz": self.parentWidget.updateGraph(self.arguments[classInd][ind][5], setAnchors = 1) else: self.parentWidget.updateGraph(self.arguments[classInd][ind][5]) | def argumentSelected(self): ind = self.argumentList.currentItem() classInd = self.classValueList.currentItem() self.parentWidget.updateGraph(self.arguments[classInd][ind][5]) |
self.statusBar.message("Evaluated %s/%s projections..." % (createStringFromNumber(existing + index), projCount)) | self.statusBar.message("Evaluated %s/%s projections..." % (OWVisFuncts.createStringFromNumber(existing + index), projCount)) | def evaluateProjections(self): # compute predictions self.widget.progressBarInit() |
OWGUI.button(self.controlArea, self, "Navigator", self.toggleNavigator) | OWGUI.button(self.controlArea, self, "Navigator", self.toggleNavigator, debuggingEnabled = 0) | def __init__(self, parent=None, signalManager = None, name='TreeViewer2D'): self.callbackDeposit = [] # deposit for OWGUI callback functions self.root = None self.selectedNode = None OWWidget.__init__(self, parent, signalManager, name) self.inputs = [("Classification Tree", orange.TreeClassifier, self.ctree)] self.out... |
""" | def getVerticesInPolygons(verticesDict): polygonVerticesDict = {} for v in verticesDict.keys(): if verticesDict[v] != -1: if not polygonVerticesDict.has_key(verticesDict[v]): polygonVerticesDict[verticesDict[v]] = [] polygonVerticesDict[verticesDict[v]].append(v) for key in polygonVerticesDict.keys(): if len(polygonVer... | |
settingsList = ["resultListLen", "minExamples", "lastSaveDirName", "attrCont", "attrDisc", "showRank", "showValue", "jitterDataBeforeTriangulation" ] | settingsList = ["resultListLen", "minExamples", "lastSaveDirName", "attrCont", "attrDisc", "showRank", "showValue", "jitterDataBeforeTriangulation", "createSnapshots"] | def pointInsideCluster(data, closure, xTest, yTest): p1 = closure[0][0] count = 0 for (p2, p3) in closure[1:]: pos = getPosition(data[p1][0], data[p1][1], data[p2][0], data[p2][1], xTest, yTest) pos2 = getPosition(data[p1][0], data[p1][1], data[p3][0], data[p3][1], xTest, yTest) if pos2 != pos: continue pos3 = getPosit... |
self.argumentationStartBox = OWGUI.widgetBox(self.ArgumentationTab, " ") | self.argumentationStartBox = OWGUI.widgetBox(self.ArgumentationTab, " Arguments ") | def __init__(self,parentWidget = None, graph = None): OWBaseWidget.__init__(self, None, "Cluster Dialog") |
testExample = [example[attr].value - float(self.graph.attrValues[attr.name][0]) / float(self.graph.attrValues[attr.name][1]-self.graph.attrValues[attr.name][0]) for attr in example.domain.attributes] | testExample = [] for attr in example.domain.attributes: if example[attr].isSpecial(): testExample.append(-1) else: testExample.append((example[attr].value - float(self.graph.attrValues[attr.name][0])) / float(self.graph.attrValues[attr.name][1]-self.graph.attrValues[attr.name][0])) | def findArguments(self): self.cancelArgumentation = 0 self.arguments = [[] for i in range(self.classValueList.count())] if self.subsetdata == None: QMessageBox.information( None, "Argumentation", 'To find arguments you first have to provide a new example that you wish to classify. \nYou can do this by sending the exam... |
self.parentWidget.removeGraphProperties() for i in range(len(self.allResults)): | if snapshots: self.parentWidget.setMinimalGraphProperties() for index in range(len(self.allResults)): | def findArguments(self): self.cancelArgumentation = 0 self.arguments = [[] for i in range(self.classValueList.count())] if self.subsetdata == None: QMessageBox.information( None, "Argumentation", 'To find arguments you first have to provide a new example that you wish to classify. \nYou can do this by sending the exam... |
(value, closure, vertices, attrList, classValue, tryIndex, strList) = self.shownResults[i] | (value, closure, vertices, attrList, classValue, tryIndex, strList) = self.allResults[index] | def findArguments(self): self.cancelArgumentation = 0 self.arguments = [[] for i in range(self.classValueList.count())] if self.subsetdata == None: QMessageBox.information( None, "Argumentation", 'To find arguments you first have to provide a new example that you wish to classify. \nYou can do this by sending the exam... |
xTest = testExample[self.graph.attributeNames.index(attrList[0])] yTest = testExample[self.graph.attributeNames.index(attrList[1])] | [xTest, yTest] = self.graph.getProjectedPointPosition(attrList, [testExample[self.graph.attributeNames.index(attrList[i])] for i in range(len(attrList))]) | def findArguments(self): self.cancelArgumentation = 0 self.arguments = [[] for i in range(self.classValueList.count())] if self.subsetdata == None: QMessageBox.information( None, "Argumentation", 'To find arguments you first have to provide a new example that you wish to classify. \nYou can do this by sending the exam... |
self.parentWidget.showAttributes(attrList, clusterClosure = closure) painter = QPainter() pic = QPixmap(QSize(100,100)) painter.begin(pic) painter.fillRect(pic.rect(), QBrush(Qt.white)) self.graph.printPlot(painter, pic.rect()) painter.flush() painter.end() self.arguments[classValue].append((pic, value, attrList, i)) | pic = None if snapshots: self.parentWidget.showAttributes(attrList, clusterClosure = closure) painter = QPainter() pic = QPixmap(QSize(120,120)) painter.begin(pic) painter.fillRect(pic.rect(), QBrush(Qt.white)) self.graph.printPlot(painter, pic.rect()) painter.flush() painter.end() self.arguments[classValue].append((... | def findArguments(self): self.cancelArgumentation = 0 self.arguments = [[] for i in range(self.classValueList.count())] if self.subsetdata == None: QMessageBox.information( None, "Argumentation", 'To find arguments you first have to provide a new example that you wish to classify. \nYou can do this by sending the exam... |
self.argumentList.insertItem(pic, "%.2f - %s" %(value, attrList)) | if snapshots: self.argumentList.insertItem(pic, "%.2f - %s" %(value, attrList)) else: self.argumentList.insertItem("%.2f - %s" %(value, attrList)) | def findArguments(self): self.cancelArgumentation = 0 self.arguments = [[] for i in range(self.classValueList.count())] if self.subsetdata == None: QMessageBox.information( None, "Argumentation", 'To find arguments you first have to provide a new example that you wish to classify. \nYou can do this by sending the exam... |
self.argumentList.insertItem(val[0], "%.2f - %s" %(val[1], val[2])) | if val[0] != None: self.argumentList.insertItem(val[0], "%.2f - %s" %(val[1], val[2])) else: self.argumentList.insertItem("%.2f - %s" %(val[1], val[2])) | def argumentationClassChanged(self): self.argumentList.clear() if len(self.arguments) == 0: return ind = self.classValueList.currentItem() for i in range(len(self.arguments[ind])): val = self.arguments[ind][i] self.argumentList.insertItem(val[0], "%.2f - %s" %(val[1], val[2])) |
print "Unable to find signal type for signal %s. Check the definition of the widget." % (outS.name) return None | continue | def getPossibleConnections(self, outputs, inputs, outConnected, inConnected): possibleLinks = [] canConnect = 0 sameType = 0 for outS in outputs: outType = self.outWidget.instance.getOutputType(outS.name) if outType == None: print "Unable to find signal type for signal %s. Check the definition of the widget." % (outS.n... |
print "Unable to find signal type for signal %s. Check the definition of the widget." % (inS.name) return None | continue | def getPossibleConnections(self, outputs, inputs, outConnected, inConnected): possibleLinks = [] canConnect = 0 sameType = 0 for outS in outputs: outType = self.outWidget.instance.getOutputType(outS.name) if outType == None: print "Unable to find signal type for signal %s. Check the definition of the widget." % (outS.n... |
""" | def addDefaultLinks(self): canConnect = 0 addedInLinks = [] addedOutLinks = [] self.multiplePossibleConnections = 0 # can we connect some signal with more than one widget | |
print "before", inConnected | def addDefaultLinks(self): canConnect = 0 addedInLinks = [] addedOutLinks = [] self.multiplePossibleConnections = 0 # can we connect some signal with more than one widget | |
print s.name if s.name in inConnected: inConnected.remove(s.name) | def addDefaultLinks(self): canConnect = 0 addedInLinks = [] addedOutLinks = [] self.multiplePossibleConnections = 0 # can we connect some signal with more than one widget | |
print "after", inConnected """ | def addDefaultLinks(self): canConnect = 0 addedInLinks = [] addedOutLinks = [] self.multiplePossibleConnections = 0 # can we connect some signal with more than one widget | |
existingLinks = [] if self.links.has_key(widgetFrom): existingLinks = self.links[widgetFrom] self.links[widgetFrom] = existingLinks + [(widgetTo, signalNameFrom, signalNameTo, enabled)] | self.links[widgetFrom] = self.links.get(widgetFrom, []) + [(widgetTo, signalNameFrom, signalNameTo, enabled)] | def addLink(self, widgetFrom, widgetTo, signalNameFrom, signalNameTo, enabled): self.addEvent("add link from " + widgetFrom.title + " to " + widgetTo.title) if not self.canConnect(widgetFrom, widgetTo): return 0 # check if signal names still exist found = 0 for o in widgetFrom.outputs: output = OutputSignal(*o) if out... |
if self.widgets.index(widgetTo) < self.widgets.index(widgetFrom): | if self.widgets.index(widgetFrom) > self.widgets.index(widgetTo): | def addLink(self, widgetFrom, widgetTo, signalNameFrom, signalNameTo, enabled): self.addEvent("add link from " + widgetFrom.title + " to " + widgetTo.title) if not self.canConnect(widgetFrom, widgetTo): return 0 # check if signal names still exist found = 0 for o in widgetFrom.outputs: output = OutputSignal(*o) if out... |
self.widgets.insert(self.widgets.index(widgetFrom)+1, widgetTo) | self.widgets.append(widgetTo) self.fixPositionOfDescendants(widgetTo) | def addLink(self, widgetFrom, widgetTo, signalNameFrom, signalNameTo, enabled): self.addEvent("add link from " + widgetFrom.title + " to " + widgetTo.title) if not self.canConnect(widgetFrom, widgetTo): return 0 # check if signal names still exist found = 0 for o in widgetFrom.outputs: output = OutputSignal(*o) if out... |
if not self.links.has_key(widgetFrom): return [] for (widget, signalNameFrom, signalNameTo, enabled) in self.links[widgetFrom]: | for (widget, signalNameFrom, signalNameTo, enabled) in self.links.get(widgetFrom, []): | def findSignals(self, widgetFrom, widgetTo): signals = [] if not self.links.has_key(widgetFrom): return [] for (widget, signalNameFrom, signalNameTo, enabled) in self.links[widgetFrom]: if widget == widgetTo: signals.append((signalNameFrom, signalNameTo)) return signals |
self.curAttribute=0 | self.curAttribute=0 self.curCutPoints=[] | def setData(self, data=None): self.clear() self.data=data if not data: self.vars=[] self.cutLineKeys=[] self.rugKeys=[] self.curAttribute=0 return self.vars=self.master.vars self.condProb=[orange.ConditionalProbabilityEstimatorConstructor_loess(orange.ContingencyAttrClass(var, self.data)) for var in self.vars] self.cut... |
cut=self.snap(cut) | def onMousePressed(self, e): self.mouseCurrentlyPressed=1 cut=self.invTransform(QwtPlot.xBottom, e.x()) cut=self.snap(cut) curve=self.getCutCurve(cut) if curve: if e.button()==Qt.RightButton: self.curCutPoints.pop(curve.curveInd) self.computeBaseScore() self.replotAll() else: cut=self.curCutPoints.pop(curve.curveInd) s... | |
elif self.getCutCurve(self.snap(self.invTransform(QwtPlot.xBottom, e.x()))): | elif self.getCutCurve(self.invTransform(QwtPlot.xBottom, e.x())): | def onMouseMoved(self, e): if self.mouseCurrentlyPressed: if self.selectedCutPoint: pos1=self.invTransform(QwtPlot.xBottom, e.x()) pos=self.snap(pos1) if self.curCutPoints[self.selectedCutPoint.curveInd]==pos: return if pos1>self.maxVal[self.master.attribute] or pos1<self.minVal[self.master.attribute]: self.curCutPoint... |
self.sizeDlg.disconnect(self.sizeDlg.okButton, SIGNAL("clicked()"), self.sizeDlg.accept) self.sizeDlg.connect(self.sizeDlg.okButton, SIGNAL("clicked()"), self.saveToFileAccept) | self.sizeDlg.printButton.setEnabled(0) self.sizeDlg.saveMatplotlibButton.setEnabled(0) self.sizeDlg.disconnect(self.sizeDlg.saveImageButton, SIGNAL("clicked()"), self.sizeDlg.saveImage) self.sizeDlg.connect(self.sizeDlg.saveImageButton, SIGNAL("clicked()"), self.saveToFileAccept) | def exportMultipleGraphs(self): (text, ok) = QInputDialog.getText('Qt Graph count', 'How many of the best projections do you wish to save?') if not ok: return self.bestGraphsCount = int(str(text)) |
size = self.sizeDlg.getSize() | def saveToFileAccept(self): fileName = str(QFileDialog.getSaveFileName("Graph","Portable Network Graphics (*.PNG);;Windows Bitmap (*.BMP);;Graphics Interchange Format (*.GIF)", None, "Save to..", "Save to..")) if fileName == "": return (fil,ext) = os.path.splitext(fileName) ext = ext.replace(".","") if ext == "": ext =... | |
name = fil + " (%02d)" % i + extension self.sizeDlg.saveToFileDirect(name, ext, size) | name = fil + " (%02d, %.2f, %d)" % (i, self.shownResults[i][ACCURACY], self.shownResults[i][LEN_TABLE]) + extension self.sizeDlg.saveImage(name, closeDialog = 0) | def saveToFileAccept(self): fileName = str(QFileDialog.getSaveFileName("Graph","Portable Network Graphics (*.PNG);;Windows Bitmap (*.BMP);;Graphics Interchange Format (*.GIF)", None, "Save to..", "Save to..")) if fileName == "": return (fil,ext) = os.path.splitext(fileName) ext = ext.replace(".","") if ext == "": ext =... |
temp += abs((stats[j][i].avg - stats[k][i].avg) / (stats[j][i].dev + stats[k][i].dev)) | if (stats[j][i].dev + stats[k][i].dev) > 0: temp += abs((stats[j][i].avg - stats[k][i].avg) / (stats[j][i].dev + stats[k][i].dev)) | def __call__(self, attr, data): # if the data changed clear the attribute values if data != self.data: self.attrInfo = {} self.data = data |
self.table.setText(row, col+2, mdict[attr] and prec % mdict[attr] or "NA") | self.table.setText(row, col+2, mdict[attr] != None and prec % mdict[attr] or "NA") | def reprint(self, noSort = False): if not self.data: return prec = " %%.%df" % self.nDecimals |
st = self.getMeasure(self.sortBy-3).items() | print self.getMeasure(self.sortBy-3).items() st = [(m, a == None and -1e20 or a) for m, a in self.getMeasure(self.sortBy-3).items()] print st | def resort(self): self.attributeOrder = self.usefulAttributes |
def removeSingleLines(graph, edgesDict, verticesDict, minimumValidIndex, newVal): | def removeSingleLines(graph, edgesDict, clusterDict, verticesDict, minimumValidIndex, newVal): | def removeSingleLines(graph, edgesDict, verticesDict, minimumValidIndex, newVal): for (i,j) in graph.getEdges(): if graph[i,j][VALUE] < minimumValidIndex: continue merged = graph.getNeighbours(i) + graph.getNeighbours(j) merged.sort() k=0; found = 0; for k in range(len(merged)-1): if merged[k] == merged[k+1] and graph[... |
found = 1 break | found = 1; break | def removeSingleLines(graph, edgesDict, verticesDict, minimumValidIndex, newVal): for (i,j) in graph.getEdges(): if graph[i,j][VALUE] < minimumValidIndex: continue merged = graph.getNeighbours(i) + graph.getNeighbours(j) merged.sort() k=0; found = 0; for k in range(len(merged)-1): if merged[k] == merged[k+1] and graph[... |
if edgesDict and verticesDict: index = max(verticesDict[j], verticesDict[i]) | if edgesDict and clusterDict and verticesDict: index = max(clusterDict[j], clusterDict[i]) | def removeSingleLines(graph, edgesDict, verticesDict, minimumValidIndex, newVal): for (i,j) in graph.getEdges(): if graph[i,j][VALUE] < minimumValidIndex: continue merged = graph.getNeighbours(i) + graph.getNeighbours(j) merged.sort() k=0; found = 0; for k in range(len(merged)-1): if merged[k] == merged[k+1] and graph[... |
verticesDict[j] = verticesDict[i] = -1 """ verticesToBrowse = graph.getNeighbours(j) verticesToBrowse.remove(i) for v in verticesToBrowse[::-1]: if graph[j,v][VALUE] < minimumValidIndex: verticesToBrowse.remove(v) searchedVertices = [j] while not found and verticesToBrowse != []: vertex = verticesToBrowse.pop() searche... | if clusterDict[i] != -1: verticesDict[clusterDict[i]].remove(i) if clusterDict[j] != -1: verticesDict[clusterDict[j]].remove(j) clusterDict[j] = clusterDict[i] = -1 | def removeSingleLines(graph, edgesDict, verticesDict, minimumValidIndex, newVal): for (i,j) in graph.getEdges(): if graph[i,j][VALUE] < minimumValidIndex: continue merged = graph.getNeighbours(i) + graph.getNeighbours(j) merged.sort() k=0; found = 0; for k in range(len(merged)-1): if merged[k] == merged[k+1] and graph[... |
def removeSingleTrianglesAndLines(graph, edgesDict, verticesDict, newVal): | def removeSingleTrianglesAndLines(graph, edgesDict, clusterDict, verticesDict, newVal): | def removeSingleTrianglesAndLines(graph, edgesDict, verticesDict, newVal): for key in edgesDict.keys(): if len(edgesDict[key]) < 4: for (i,j) in edgesDict[key]: graph[i,j][VALUE] = newVal graph[i,j][CLUSTER] = -1 verticesDict[i] = -1; verticesDict[j] = -1; edgesDict.pop(key) |
if len(edgesDict[key]) < 4: | if len(verticesDict[key]) < 5: | def removeSingleTrianglesAndLines(graph, edgesDict, verticesDict, newVal): for key in edgesDict.keys(): if len(edgesDict[key]) < 4: for (i,j) in edgesDict[key]: graph[i,j][VALUE] = newVal graph[i,j][CLUSTER] = -1 verticesDict[i] = -1; verticesDict[j] = -1; edgesDict.pop(key) |
verticesDict[i] = -1; verticesDict[j] = -1; | clusterDict[i] = -1; clusterDict[j] = -1; verticesDict.pop(key) | def removeSingleTrianglesAndLines(graph, edgesDict, verticesDict, newVal): for key in edgesDict.keys(): if len(edgesDict[key]) < 4: for (i,j) in edgesDict[key]: graph[i,j][VALUE] = newVal graph[i,j][CLUSTER] = -1 verticesDict[i] = -1; verticesDict[j] = -1; edgesDict.pop(key) |
def removeDistantPointsFromClusters(graph, edgesDict, verticesDict, closureDict, newVal): | def removeDistantPointsFromClusters(graph, edgesDict, clusterDict, verticesDict, closureDict, newVal): | def removeDistantPointsFromClusters(graph, edgesDict, verticesDict, closureDict, newVal): for key in closureDict.keys(): edges = closureDict[key] vertices = [i for (i,j) in edges] + [j for (i,j) in edges] vertices.sort() for i in range(len(vertices)-1)[::-1]: if vertices[i] == vertices[i+1]: vertices.remove(vertices[i]... |
if int(graph.objects[n].getclass()) == correctClass and graph[vertex,n][CLUSTER] == -1: continue | def removeDistantPointsFromClusters(graph, edgesDict, verticesDict, closureDict, newVal): for key in closureDict.keys(): edges = closureDict[key] vertices = [i for (i,j) in edges] + [j for (i,j) in edges] vertices.sort() for i in range(len(vertices)-1)[::-1]: if vertices[i] == vertices[i+1]: vertices.remove(vertices[i]... | |
if correct == [] or (len(incorrect) > 0 and min(incorrect) < min(correct)): | if correct == [] or (len(incorrect) > 0 and min(correct) > min(incorrect)): correctClassNeighbors = [] | def removeDistantPointsFromClusters(graph, edgesDict, verticesDict, closureDict, newVal): for key in closureDict.keys(): edges = closureDict[key] vertices = [i for (i,j) in edges] + [j for (i,j) in edges] vertices.sort() for i in range(len(vertices)-1)[::-1]: if vertices[i] == vertices[i+1]: vertices.remove(vertices[i]... |
if int(graph.objects[n].getclass()) != correctClass or graph[vertex,n][CLUSTER] == -1: continue | if int(graph.objects[n].getclass()) == correctClass and graph[vertex,n][CLUSTER] != -1: correctClassNeighbors.append(n) for i in correctClassNeighbors: for j in correctClassNeighbors: if i==j: continue if (i,j) in edges: graph[i,j][CLUSTER] = -1 if newVal == None: graph[i,j] = None else: graph[i,j][VALUE... | def removeDistantPointsFromClusters(graph, edgesDict, verticesDict, closureDict, newVal): for key in closureDict.keys(): edges = closureDict[key] vertices = [i for (i,j) in edges] + [j for (i,j) in edges] vertices.sort() for i in range(len(vertices)-1)[::-1]: if vertices[i] == vertices[i+1]: vertices.remove(vertices[i]... |
verticesDict[n] = verticesDict[vertex] = -1 | def removeDistantPointsFromClusters(graph, edgesDict, verticesDict, closureDict, newVal): for key in closureDict.keys(): edges = closureDict[key] vertices = [i for (i,j) in edges] + [j for (i,j) in edges] vertices.sort() for i in range(len(vertices)-1)[::-1]: if vertices[i] == vertices[i+1]: vertices.remove(vertices[i]... | |
""" minWrongClassDistance = 2*minCorrectClassDistance for key in classes.keys(): if key == correctClass or classes[key] == []: continue minWrongClassDistance = min(minWrongClassDistance, min(classes[key])) if minWrongClassDistance < minCorrectClassDistance: for n in graph.getNeighbours(i): if graph.objects[n].getclass... | if clusterDict[vertex] != -1: verticesDict[key].remove(vertex) clusterDict[vertex] = -1 | def removeDistantPointsFromClusters(graph, edgesDict, verticesDict, closureDict, newVal): for key in closureDict.keys(): edges = closureDict[key] vertices = [i for (i,j) in edges] + [j for (i,j) in edges] vertices.sort() for i in range(len(vertices)-1)[::-1]: if vertices[i] == vertices[i+1]: vertices.remove(vertices[i]... |
def computeClosure(graph, edgesDict, minimumValidIndex, innerEdgeValue, outerEdgeValue): | def computeClosure(graph, edgesDict, minimumValidIndex, innerEdgeValue, outerEdgeValue, differentClassValue, tooDistantValue): | def computeClosure(graph, edgesDict, minimumValidIndex, innerEdgeValue, outerEdgeValue): closureDict = {} for key in edgesDict.keys(): closureDict[key] = [] # create dictionary where each cluster will contain all edges that lie on the closure for (i,j) in graph.getEdges(): if graph[i,j][VALUE] < minimumValidIndex: con... |
if graph[i,j][VALUE] < minimumValidIndex: continue if graph[i,j][CLUSTER] == -1: continue | if graph[i,j][VALUE] < minimumValidIndex or graph[i,j][CLUSTER] == -1: continue | def computeClosure(graph, edgesDict, minimumValidIndex, innerEdgeValue, outerEdgeValue): closureDict = {} for key in edgesDict.keys(): closureDict[key] = [] # create dictionary where each cluster will contain all edges that lie on the closure for (i,j) in graph.getEdges(): if graph[i,j][VALUE] < minimumValidIndex: con... |
k=0; found = []; for k in range(len(merged)-1): if merged[k] == merged[k+1] and graph[i, merged[k]][VALUE] >= minimumValidIndex and graph[j, merged[k]][VALUE] >= minimumValidIndex: found.append(merged[k]) graph[i,j][VALUE] = outerEdgeValue closureDict[graph[i,j][CLUSTER]].append((i,j)) if found == []: | k=0; sameClassPoints = []; otherClassPoints = [] while k < len(merged)-1: if merged[k] == merged[k+1]: if graph[i, merged[k]][VALUE] >= minimumValidIndex and graph[j, merged[k]][VALUE] >= minimumValidIndex: sameClassPoints.append(merged[k]) elif graph[i, merged[k]][VALUE] == graph[j, merged[k]][VALUE] == differentClass... | def computeClosure(graph, edgesDict, minimumValidIndex, innerEdgeValue, outerEdgeValue): closureDict = {} for key in edgesDict.keys(): closureDict[key] = [] # create dictionary where each cluster will contain all edges that lie on the closure for (i,j) in graph.getEdges(): if graph[i,j][VALUE] < minimumValidIndex: con... |
closureDict[graph[i,j][CLUSTER]].remove((i,j)) elif len(found) != 1: dir = getPosition(graph.objects[i][0].value, graph.objects[i][1].value, graph.objects[j][0].value, graph.objects[j][1].value, graph.objects[found[0]][0].value, graph.objects[found[0]][1].value) for val in found[1:]: dir2 = getPosition(graph.objects[i]... | def computeClosure(graph, edgesDict, minimumValidIndex, innerEdgeValue, outerEdgeValue): closureDict = {} for key in edgesDict.keys(): closureDict[key] = [] # create dictionary where each cluster will contain all edges that lie on the closure for (i,j) in graph.getEdges(): if graph[i,j][VALUE] < minimumValidIndex: con... | |
for i in range(graph.nVertices): verticesDict[i] = -1 | for i in range(graph.nVertices): clusterDict[i] = -1 | def enumerateClusters(graph, minimumValidValue): clusterIndex = 1 verticesDict = {} edgesDict = {} for (i,j) in graph.getEdges(): graph[i,j][CLUSTER] = -1 # initialize class cluster for i in range(graph.nVertices): verticesDict[i] = -1 for i in range(graph.nVertices): if graph.getNeighbours(i) == [] or verticesDict[... |
if graph.getNeighbours(i) == [] or verticesDict[i] != -1: continue | if graph.getNeighbours(i) == [] or clusterDict[i] != -1: continue | def enumerateClusters(graph, minimumValidValue): clusterIndex = 1 verticesDict = {} edgesDict = {} for (i,j) in graph.getEdges(): graph[i,j][CLUSTER] = -1 # initialize class cluster for i in range(graph.nVertices): verticesDict[i] = -1 for i in range(graph.nVertices): if graph.getNeighbours(i) == [] or verticesDict[... |
if verticesDict[current] != -1: continue verticesDict[current] = clusterIndex | if clusterDict[current] != -1: continue clusterDict[current] = clusterIndex verticesDict[clusterIndex].append(current) | def enumerateClusters(graph, minimumValidValue): clusterIndex = 1 verticesDict = {} edgesDict = {} for (i,j) in graph.getEdges(): graph[i,j][CLUSTER] = -1 # initialize class cluster for i in range(graph.nVertices): verticesDict[i] = -1 for i in range(graph.nVertices): if graph.getNeighbours(i) == [] or verticesDict[... |
if verticesDict[n] == -1: | if clusterDict[n] == -1: | def enumerateClusters(graph, minimumValidValue): clusterIndex = 1 verticesDict = {} edgesDict = {} for (i,j) in graph.getEdges(): graph[i,j][CLUSTER] = -1 # initialize class cluster for i in range(graph.nVertices): verticesDict[i] = -1 for i in range(graph.nVertices): if graph.getNeighbours(i) == [] or verticesDict[... |
return (edgesDict, verticesDict, clusterIndex-1) | return (edgesDict, clusterDict, verticesDict, clusterIndex-1) | def enumerateClusters(graph, minimumValidValue): clusterIndex = 1 verticesDict = {} edgesDict = {} for (i,j) in graph.getEdges(): graph[i,j][CLUSTER] = -1 # initialize class cluster for i in range(graph.nVertices): verticesDict[i] = -1 for i in range(graph.nVertices): if graph.getNeighbours(i) == [] or verticesDict[... |
def fixDeletedEdges(graph, verticesDict, edgesDict, deletedEdgeValue, repairValue, deleteValue): | def fixDeletedEdges(graph, edgesDict, clusterDict, deletedEdgeValue, repairValue, deleteValue): | def fixDeletedEdges(graph, verticesDict, edgesDict, deletedEdgeValue, repairValue, deleteValue): for (i,j) in graph.getEdges(): if graph[i,j][VALUE] == deletedEdgeValue: if verticesDict[i] == verticesDict[j]: graph[i,j][VALUE] = repairValue # restore the value of the edge graph[i,j][CLUSTER] = verticesDict[... |
if verticesDict[i] == verticesDict[j]: | if clusterDict[i] == clusterDict[j]: | def fixDeletedEdges(graph, verticesDict, edgesDict, deletedEdgeValue, repairValue, deleteValue): for (i,j) in graph.getEdges(): if graph[i,j][VALUE] == deletedEdgeValue: if verticesDict[i] == verticesDict[j]: graph[i,j][VALUE] = repairValue # restore the value of the edge graph[i,j][CLUSTER] = verticesDict[... |
graph[i,j][CLUSTER] = verticesDict[i] edgesDict[verticesDict[i]].append((i,j)) | graph[i,j][CLUSTER] = clusterDict[i] edgesDict[clusterDict[i]].append((i,j)) | def fixDeletedEdges(graph, verticesDict, edgesDict, deletedEdgeValue, repairValue, deleteValue): for (i,j) in graph.getEdges(): if graph[i,j][VALUE] == deletedEdgeValue: if verticesDict[i] == verticesDict[j]: graph[i,j][VALUE] = repairValue # restore the value of the edge graph[i,j][CLUSTER] = verticesDict[... |
def computeAreas(graph, closureDict, outerEdgeValue): | def computeAreas(graph, edgesDict, clusterDict, verticesDict, closureDict, outerEdgeValue): | def computeAreas(graph, closureDict, outerEdgeValue): areaDict = {} for key in closureDict.keys(): currArea = 0.0 edges = closureDict[key] # select outer edges coveredEdges = [] while len(coveredEdges) < len(edges): for (e1, e2) in edges: if (e1, e2) not in coveredEdges and (e2, e1) not in coveredEdges: break polygons ... |
p1 = closure[0][0] | def pointInsideCluster(data, closure, xTest, yTest): p1 = closure[0][0] count = 0 for (p2, p3) in closure[1:]: pos = getPosition(data[p1][0], data[p1][1], data[p2][0], data[p2][1], xTest, yTest) pos2 = getPosition(data[p1][0], data[p1][1], data[p3][0], data[p3][1], xTest, yTest) if pos2 != pos: continue pos3 = getPosit... | |
for (p2, p3) in closure[1:]: pos = getPosition(data[p1][0], data[p1][1], data[p2][0], data[p2][1], xTest, yTest) pos2 = getPosition(data[p1][0], data[p1][1], data[p3][0], data[p3][1], xTest, yTest) if pos2 != pos: continue pos3 = getPosition(data[p2][0], data[p2][1], data[p3][0], data[p3][1], xTest, yTest) if pos3 == p... | for (p2, p3) in closure: | def pointInsideCluster(data, closure, xTest, yTest): p1 = closure[0][0] count = 0 for (p2, p3) in closure[1:]: pos = getPosition(data[p1][0], data[p1][1], data[p2][0], data[p2][1], xTest, yTest) pos2 = getPosition(data[p1][0], data[p1][1], data[p3][0], data[p3][1], xTest, yTest) if pos2 != pos: continue pos3 = getPosit... |
if count % 2 == 1: return 1 else: return 0 | return count % 2 | def pointInsideCluster(data, closure, xTest, yTest): p1 = closure[0][0] count = 0 for (p2, p3) in closure[1:]: x1 = data[p2][0] - xTest; y1 = data[p2][1] - yTest x2 = data[p3][0] - xTest; y2 = data[p3][1] - yTest if (y1 > 0 and y2 <= 0) or (y2 > 0 and y1 <= 0): x = (x1 * y2 - x2 * y1) / (y2 - y1) if x > 0: count += 1 i... |
self.topLayout = QVBoxLayout( self, 10 ) self.grid=QGridLayout(5,2) self.topLayout.addLayout( self.grid, 10 ) | self.controlArea = QVBoxLayout(self) | def __init__(self, parentWidget = None, graph = None): OWBaseWidget.__init__(self, None, "Cluster Dialog") |
removeSingleLines(graph, None, None, 0, -1) edgesDict, verticesDict, count = enumerateClusters(graph, 0) closureDict = computeClosure(graph, edgesDict, 1, 1, 1) bigPolygonVerticesDict = getVerticesInPolygons(verticesDict) otherClassDict = getPointsWithDifferentClassValue(graph, closureDict) removeSingleTrianglesAnd... | removeSingleLines(graph, None, None, None, 0, -1) edgesDict, clusterDict, verticesDict, count = enumerateClusters(graph, 0) closureDict = computeClosure(graph, edgesDict, 1, 1, 1, -3, -4) bigPolygonVerticesDict = copy(verticesDict) otherClassDict = getPointsWithDifferentClassValue(graph, closureDict) removeSingleTria... | def evaluateClusters(self, data): #fullgraph = orange.triangulate(data,3) graph = orange.triangulate(data,3) graph.returnIndices = 1 computeDistances(graph) removeEdgesToDifferentClasses(graph, -3) # None removeSingleLines(graph, None, None, 0, -1) edgesDict, verticesDict, count = enumerateClusters(graph, 0) |
closureDict = computeClosure(graph, edgesDict, 1, 1, 2) polygonVerticesDict = getVerticesInPolygons(verticesDict) areaDict = computeAreas(graph, closureDict, 2) | closureDict = computeClosure(graph, edgesDict, 1, 1, 2, -3, -2) polygonVerticesDict = verticesDict areaDict = computeAreas(graph, edgesDict, clusterDict, verticesDict, closureDict, 2) | def evaluateClusters(self, data): #fullgraph = orange.triangulate(data,3) graph = orange.triangulate(data,3) graph.returnIndices = 1 computeDistances(graph) removeEdgesToDifferentClasses(graph, -3) # None removeSingleLines(graph, None, None, 0, -1) edgesDict, verticesDict, count = enumerateClusters(graph, 0) |
value = points * dist / area | area = sqrt(area) if area > 0: value = points * dist / area else: value = 0 | def evaluateClusters(self, data): #fullgraph = orange.triangulate(data,3) graph = orange.triangulate(data,3) graph.returnIndices = 1 computeDistances(graph) removeEdgesToDifferentClasses(graph, -3) # None removeSingleLines(graph, None, None, 0, -1) edgesDict, verticesDict, count = enumerateClusters(graph, 0) |
def resizeEvent(self, ev): self.tabs.resize(ev.size().width(), ev.size().height()) | def resizeEvent(self, ev): self.tabs.resize(ev.size().width(), ev.size().height()) | |
statI = self.stats[self.stats.keys()[i]] | def MeasureAttribute_info(self, attr, data): # if basic statistics is not computed for this dataset -> compute it if not (self.stats and self.dataset == data): self.stats = {} self.dataset = data | |
val = abs(statI[attribute].avg - statJ[attribute].avg) * (statI[attribute].n + statJ[attribute].n)/(statI[attribute].n * statI[attribute].dev + statJ[attribute].n * statJ[attribute].dev) | bottom = (statI[attribute].n * statI[attribute].dev + statJ[attribute].n * statJ[attribute].dev) if bottom == 0.0: bottom = 0.001 val = abs(statI[attribute].avg - statJ[attribute].avg) * (statI[attribute].n + statJ[attribute].n)/bottom | def MeasureAttribute_info(self, attr, data): # if basic statistics is not computed for this dataset -> compute it if not (self.stats and self.dataset == data): self.stats = {} self.dataset = data |
self.shriniking=1 | self.shrinking=1 | def __init__(self, **kwds): self.learner=orange.SVMLearner() self.svm_type=0 self.kernel_type=2 self.kernelFunc=None self.C=1.0 self.nu=0.4 self.p=0.1 self.gamma=0.2 self.degree=3 self.coef0=0 self.shriniking=1 self.probability=0 self.cache_size=100 self.eps=0.001 self.__dict__.update(kwds) self.learner=orange.SVMLearn... |
if not self.learner: if self.svm_type in [0,1] and examples.domain.classVar.varType!=orange.varType.Discrete: raise AttributeError, "Cannot learn a discrete classifier from non descrete class data. Use EPSILON_SVR or NU_SVR for regression" if self.svm_type in [3,4] and examples.domain.classVar.varType==orange.varType.D... | if self.svm_type in [0,1] and examples.domain.classVar.varType!=orange.VarTypes.Discrete: raise AttributeError, "Cannot learn a discrete classifier from non descrete class data. Use EPSILON_SVR or NU_SVR for regression" if self.svm_type in [3,4] and examples.domain.classVar.varType==orange.VarTypes.Discrete: raise Attr... | def __call__(self, examples, weight=0): if not self.learner: if self.svm_type in [0,1] and examples.domain.classVar.varType!=orange.varType.Discrete: raise AttributeError, "Cannot learn a discrete classifier from non descrete class data. Use EPSILON_SVR or NU_SVR for regression" if self.svm_type in [3,4] and examples.d... |
self.scores[i].append(eval('orngStat.' + stat[2])[0]) | try: self.scores[i].append(eval('orngStat.' + stat[2])[0]) except: self.scores[i].append(-1) type, val, traceback = sys.exc_info() sys.excepthook(type, val, traceback) self.error("Caught an exception while evaluating classifiers") | def test(self, learner=None): pb = ProgressBar(self, iterations=self.nFolds) |
self.scores[i][indx] = eval('orngStat.' + stat[2])[0] | try: self.scores[i][indx] = eval('orngStat.' + stat[2])[0] except: self.scores[i][indx] = -1 type, val, traceback = sys.exc_info() sys.excepthook(type, val, traceback) self.error("Caught an exception while evaluating classifiers") | def test(self, learner=None): pb = ProgressBar(self, iterations=self.nFolds) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.