rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
for j in range(len(cls[i])): | added = 0 while cls[i] != [] and added == 0: | def evaluateAttributes(data, contMeasure, discMeasure): attrs = []; contAttrs = [] corr = MeasureCorrelation() for attr in data.domain.attributes: if data.domain.classVar.varType == orange.VarTypes.Continuous and attr.varType == orange.VarTypes.Continuous: attrs.append((corr(attr.name, data), attr.name)) elif data.doma... |
break | added = 1 ableToAdd = 1 | def evaluateAttributes(data, contMeasure, discMeasure): attrs = []; contAttrs = [] corr = MeasureCorrelation() for attr in data.domain.attributes: if data.domain.classVar.varType == orange.VarTypes.Continuous and attr.varType == orange.VarTypes.Continuous: attrs.append((corr(attr.name, data), attr.name)) elif data.doma... |
widget.synchronizeContexts() | widget.instance.synchronizeContexts() | def synchronizeContexts(self): for widget in self.widgets[::-1]: widget.synchronizeContexts() |
e.ignore() | QDialog.keyPressEvent(self, e) | def keyPressEvent(self, e): if e.key() != 0x1030: e.ignore() else: self.openWidgetHelp() |
hb = widgetBox(widget, box, orientation) widgetLabel(hb, label, labelWidth) if tooltip: QToolTip.add(hb, tooltip) combo = QComboBox(hb) if items: for i in items: combo.insertItem(str(i)) if len(items)>0: if sendSelectedValue: combo.setCurrentItem(items.index(getattr(master, value))) else: combo.setCurr... | hb = widgetBox(widget, box, orientation) widgetLabel(hb, label, labelWidth) if tooltip: QToolTip.add(hb, tooltip) combo = QComboBox(hb) if items: for i in items: combo.insertItem(str(i)) if len(items)>0: if sendSelectedValue and getattr(master, value) in items: combo.setCurrentItem(items.index(getattr(master, value)))... | def comboBox(widget, master, value, box=None, label=None, labelWidth=None, orientation='vertical', items=None, tooltip=None, callback=None, sendSelectedValue = 0, valueType = str): hb = widgetBox(widget, box, orientation) widgetLabel(hb, label, labelWidth) if tooltip: QToolTip.add(hb, tooltip) combo = QComboBox(hb) if... |
self.autoSetTheKValue = 1 | self.autoSetTheKValue = 1 self.kValueFormula = 1 | def __init__(self, parentWidget = None, signalManager = None, graph = None, parentName = "Visualization widget"): OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog") |
correct = sqrt(len(data)); | if self.kValueFormula == 0: correct = sqrt(len(data)) elif self.kValueFormula == 1: correct = len(data) / len(data.domain.classVar.values) | def setData(self, data): if hasattr(data, "name"): self.datasetName = data.name else: self.datasetName = "" sameDomain = 0 if self.rawdata and data and self.rawdata.domain == data.domain: sameDomain = 1 self.rawdata = data self.clearArguments() if not sameDomain: self.clearResults() if not data or not (data.domain.cla... |
self.evaluatedAttributes = (None, None, None) | def setData(self, data): if hasattr(data, "name"): self.datasetName = data.name else: self.datasetName = "" sameDomain = 0 if self.rawdata and data and self.rawdata.domain == data.domain: sameDomain = 1 self.rawdata = data self.clearArguments() if not sameDomain: self.clearResults() if not data or not (data.domain.cla... | |
selectedClassesStr = [data.domain.classVar.values[i] for i in self.selectedClasses] nonSelectedClassesStr = [] for val in data.domain.classVar.values: if val not in selectedClassesStr: nonSelectedClassesStr.append(val) if len(nonSelectedClassesStr) > 0: selection = orange.EnumVariable("Selection", values = selectedCla... | def getEvaluatedAttributes(self, data): self.setStatusBarText("Evaluating attributes...") qApp.setOverrideCursor(QWidget.waitCursor) selectedClassesStr = [data.domain.classVar.values[i] for i in self.selectedClasses] nonSelectedClassesStr = [] for val in data.domain.classVar.values: if val not in selectedClassesStr: no... | |
if self.parentName == "Radviz" and self.parentWidget.graph.anchorData != []: for i in range(min(5, self.parentWidget.shownAttribsLB.count())): if attrs == None and abs(self.parentWidget.graph.anchorData[i][0]**2 + self.parentWidget.graph.anchorData[i][1]**2 -1) > 0.001: c = self.parentWidget.shownAttribsLB.count() attr... | try: if data.domain.classVar.varType == orange.VarTypes.Discrete: selectedClassesStr = [data.domain.classVar.values[i] for i in self.selectedClasses] nonSelectedClassesStr = [] for val in data.domain.classVar.values: if val not in selectedClassesStr: nonSelectedClassesStr.append(val) if len(nonSelectedClassesStr) > 0:... | def getEvaluatedAttributes(self, data): self.setStatusBarText("Evaluating attributes...") qApp.setOverrideCursor(QWidget.waitCursor) selectedClassesStr = [data.domain.classVar.values[i] for i in self.selectedClasses] nonSelectedClassesStr = [] for val in data.domain.classVar.values: if val not in selectedClassesStr: no... |
if self.recentProjectionFiles[0] != "(None)" and os.path.exists(self.recentProjectionFiles[0]): self.setStatusBarText("Reading attributes from the projection file...") f = open(self.recentProjectionFiles[0], "rt") f.readline(); f.readline() line = f.readline()[:-1] projAttrs = []; validProjectionFile = 1 while (line !=... | if self.parentName == "Radviz" and self.parentWidget.graph.anchorData != []: for i in range(min(5, self.parentWidget.shownAttribsLB.count())): if attrs == None and abs(self.parentWidget.graph.anchorData[i][0]**2 + self.parentWidget.graph.anchorData[i][1]**2 -1) > 0.001: c = self.parentWidget.shownAttribsLB.count() attr... | def getEvaluatedAttributes(self, data): self.setStatusBarText("Evaluating attributes...") qApp.setOverrideCursor(QWidget.waitCursor) selectedClassesStr = [data.domain.classVar.values[i] for i in self.selectedClasses] nonSelectedClassesStr = [] for val in data.domain.classVar.values: if val not in selectedClassesStr: no... |
return attrs | if attrs == None: return [] else: return attrs | def getEvaluatedAttributes(self, data): self.setStatusBarText("Evaluating attributes...") qApp.setOverrideCursor(QWidget.waitCursor) selectedClassesStr = [data.domain.classVar.values[i] for i in self.selectedClasses] nonSelectedClassesStr = [] for val in data.domain.classVar.values: if val not in selectedClassesStr: no... |
currentClassDistribution = orange.Distribution(testTable.domain.classVar, testTable) currentClassDistribution = [int(v) for v in currentClassDistribution] prediction = [0.0 for i in range(len(testTable.domain.classVar.values))] | if len(testTable) == 0: return 0,0 | def kNNComputeAccuracy(self, table): # ############################### # select a subset of the data if necessary # ############################### if self.percentDataUsed != 100: indices = orange.MakeRandomIndices2(table, 1.0-float(self.percentDataUsed)/100.0) testTable = table.select(indices) else: testTable = table |
returnTable.append(res.probabilities[0].density(res.actualClass)) | if not res.probabilities[0]: returnTable.append(0) else: returnTable.append(res.probabilities[0].density(res.actualClass)) | def kNNClassifyData(self, table): qApp.processEvents() # allow processing of other events knn = orange.kNNLearner(k=self.kValue, rankWeight = 0, distanceConstructor = orange.ExamplesDistanceConstructor_Euclidean(normalize=0)) results = apply(testingMethods[self.testingMethod], [[knn], table]) returnTable = [] ... |
all_attributes = [i for i in t.domain.attributes]+[t.domain.classVar] | all_attributes = [i for i in t.domain.attributes] if t.domain.classVar: all_attributes += [t.domain.classVar] | def _prepare(self, t): # prepares an Orange table so that it doesn't contain continuous # attributes or missing values |
print 'REMOVE', id, 'FROM', self.learners | def learner(self, learner, id=None): if learner: # a new or updated learner # print 'Add/Upd', learner.name, ", id:", id learner.id = id # remember id's of learners self.test(learner) if self.learners: if id not in [l.id for l in self.learners]: self.learners.append(learner) else: self.learners = [learner] self.applyBt... | |
for i,r in enumerate(self.results.results): | del self.results.classifierNames[indx] self.results.numberOfLearners -= 1 for i, r in enumerate(self.results.results): | def learner(self, learner, id=None): if learner: # a new or updated learner # print 'Add/Upd', learner.name, ", id:", id learner.id = id # remember id's of learners self.test(learner) if self.learners: if id not in [l.id for l in self.learners]: self.learners.append(learner) else: self.learners = [learner] self.applyBt... |
del self.results.classifierNames[indx] self.results.numberOfLearners -= 1 for (i, stat) in enumerate(self.stat): del self.scores[i][indx] | for (i, stat) in enumerate(self.stat): del self.scores[i][indx] | def learner(self, learner, id=None): if learner: # a new or updated learner # print 'Add/Upd', learner.name, ", id:", id learner.id = id # remember id's of learners self.test(learner) if self.learners: if id not in [l.id for l in self.learners]: self.learners.append(learner) else: self.learners = [learner] self.applyBt... |
testcase = 1 | testcase = 2 | def finish(self): self.widget.progressBarFinished() |
ow.learner(None, 2) | def finish(self): self.widget.progressBarFinished() | |
accuracy, other_results = self.getProjectionQuality(attrList, generalDict) | table = self.graph.createProjectionAsExampleTable([self.attributeNameIndex[attr] for attr in attrList], settingsDict = generalDict) accuracy, other_results = self.kNNComputeAccuracy(table) | def reevaluateAllProjections(self): results = list(self.getShownResults()) self.clearResults() |
graph.coloringScaledData = self.graphs[0].coloringScaledData | graph.validDataArray = self.graphs[0].validDataArray graph.attributeNameIndex = self.graphs[0].attributeNameIndex graph.domainDataStat = self.graphs[0].domainDataStat graph.attributeNames = self.graphs[0].attributeNames | def updateJitteringSettings(self): if self.graphs == []: return self.graphs[0].setJitteringOption(self.jitteringType) self.graphs[0].setJitterContinuous(self.jitterContinuous) self.graphs[0].jitterSize = self.jitterSize for graph in self.graphs[1:]: graph.jitterSize = self.jitterSize graph.setJitterContinuous(self.jitt... |
graph.coloringScaledData = self.graphs[0].coloringScaledData | graph.validDataArray = self.graphs[0].validDataArray | def createGraphs(self): self.removeAllGraphs() |
self.attr2 = str(self.attr2Combo.text(1 + (self.attr2Combo.count() > 1))) | self.attr2 = str(self.attr2Combo.text(0 + 2*(self.attr2Combo.count() > 2))) | def initCombos(self, data): self.attr1Combo.clear(); self.attr2Combo.clear(); self.attr3Combo.clear(); self.attr4Combo.clear() |
f.write('levels=c('%(labels[i])) | f.write('levels=c(') | def toR(filename,t): if string.upper(filename[-2:]) == ".R": filename = filename[:-2] f = open(filename+'.R','w') atyp = [] aord = [] labels = [] as = [] for a in t.domain.attributes: as.append(a) as.append(t.domain.classVar) for a in as: labels.append(str(a.name)) atyp.append(a.varType) aord.append(a.ordered) f.writ... |
shown.append(data.domain.classVar.name) | def selectAttributes(data, attrContOrder, attrDiscOrder, projections = None): if data.domain.classVar == None or data.domain.classVar.varType != orange.VarTypes.Discrete: return ([attr.name for attr in data.domain.attributes], [], 0) shown = [data.domain.classVar.name]; hidden = []; maxIndex = 0 # initialize output... | |
optimizeAttributeOrder(attrInfo, currentProj, currentVal, numberOfAttributes, optimizationDlg, app) | if len(currentProj) < numberOfAttributes/2: optimizeAttributeOrder(attrInfo, currentProj, currentVal, numberOfAttributes, optimizationDlg, app) | def optimizeAttributeOrder(attrInfo, currentProj, currentVal, numberOfAttributes, optimizationDlg, app = None): if len(currentProj) == numberOfAttributes: for attr in currentProj: if currentProj.count(attr) > 1: return optimizationDlg.addProjection(currentVal/(numberOfAttributes-1), currentProj) return elif attrInfo ==... |
for i in imputer(examples)(examples): print i | def __call__(self, examples, weight=0): imputer = getattr(self, "imputer", None) or None if getattr(self, "removeMissing", 0): examples = orange.Preprocessor_dropMissing(examples) if hasDiscreteValues(examples.domain): examples = createNoDiscTable(examples) if getattr(self, "stepwiseLR", 0): addCrit = getattr(self, "ad... | |
self.send("KNN Classificatier", self.classifier) | self.send("KNN Classifier", self.classifier) | def learn(self): if self.data and self.learner: self.classifier = self.learner(self.data) self.classifier.name = self.name self.send("KNN Classificatier", self.classifier) |
def saveToFileDirect(self, fileName, ext, size = QSize(), overwriteExisting = 0): | def saveToFileDirect(self, fileName, size = None): | def saveToFileDirect(self, fileName, ext, size = QSize(), overwriteExisting = 0): sizeDlg = OWChooseImageSizeDlg(self) sizeDlg.saveToFileDirect(fileName, ext, size, overwriteExisting) |
sizeDlg.saveToFileDirect(fileName, ext, size, overwriteExisting) | sizeDlg.saveImage(fileName, size) | def saveToFileDirect(self, fileName, ext, size = QSize(), overwriteExisting = 0): sizeDlg = OWChooseImageSizeDlg(self) sizeDlg.saveToFileDirect(fileName, ext, size, overwriteExisting) |
self.stopOptimizationBox = OWGUI.widgetBox(self.SettingsTab, " When to Stop Evaluation? ") | self.stopOptimizationBox = OWGUI.collapsableWidgetBox(self.SettingsTab, " When to Stop Evaluation? ", self, "boxStopOptimization") | def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog") |
self.localOptimizationSettingsBox = OWGUI.widgetBox(self.SettingsTab, " Local Optimization Settings ") OWGUI.checkBox(self.localOptimizationSettingsBox, self, 'locOptOptimizeProjectionByPermutingAttributes', 'Try improving projection by permuting attributes in projection') | self.localOptimizationSettingsBox = OWGUI.collapsableWidgetBox(self.SettingsTab, " Local Optimization Settings ", self, "boxLocalOptimization") bbb = OWGUI.checkBox(self.localOptimizationSettingsBox, self, 'locOptOptimizeProjectionByPermutingAttributes', 'Try improving projection by permuting attributes in projection') | def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog") |
self.resize(375,700) | def __init__(self, parentWidget = None, signalManager = None, graph = None, visualizationMethod = SCATTERPLOT, parentName = "Visualization widget"): VizRank.__init__(self, visualizationMethod, graph) OWBaseWidget.__init__(self, None, signalManager, "Optimization Dialog") | |
qApp.processEvents() | def kNNClassifyData(self, table): qApp.processEvents() # allow processing of other events if self.externalLearner: learner = self.externalLearner else: learner = self.createkNNLearner() results = apply(testingMethods[self.testingMethod], [[learner], table]) returnTable = [] if table.domain.... | |
line = file.readline()[:-1]; ind = 0 | if type(eval(file.readline()[:-1])) != list: QMessageBox.critical(None,'Old version of projection file','This file was saved with an older version of k-NN Optimization Dialog. The new version of dialog offers \nsome additional functionality and therefore you have to compute the projection quality again.',QMessageBox.Ok... | def loadProjections(self, name = None): self.projections = [] self.kNeighborsLabel.setText("Number of neighbors (k): " ) self.percentDataUsedLabel.setText("Percent of data used:" ) self.testingMethodLabel.setText("Testing method used:" ) self.qualityMeasureLabel.setText("Quality measure used:" ) if name == None: name ... |
(acc, lenTable, attrList, strList) = eval(line) | (acc, other_results, lenTable, attrList, strList) = eval(line) | def loadProjections(self, name = None): self.projections = [] self.kNeighborsLabel.setText("Number of neighbors (k): " ) self.percentDataUsedLabel.setText("Percent of data used:" ) self.testingMethodLabel.setText("Testing method used:" ) self.qualityMeasureLabel.setText("Quality measure used:" ) if name == None: name ... |
for i in range(len(prediction)): prediction[i] /= float(currentClassDistribution[i]) | for i in range(len(prediction)): if currentClassDistribution[i] > 0: prediction[i] /= float(currentClassDistribution[i]) else: prediction[i] = 0 | def kNNComputeAccuracy(self, table): # ############################### # select a subset of the data if necessary # ############################### percentDataUsed = int(str(self.percentDataUsedCombo.currentText())) if percentDataUsed != 100: indices = orange.MakeRandomIndices2(table, 1.0-float(percentDataUsed)/100.0) ... |
self.points = orangemds.FloatListList(matrixmultiply(Ut,Dt)) | self.points = orange.FloatListList(matrixmultiply(Ut,Dt)) | def Torgerson(self): # Torgerson's initial approximation O=array([m for m in self.distances]) B = matrixmultiply(O,O) # double-center B cavg = sum(B)/(self.n+0.0) # column sum ravg = sum(B,1)/(self.n+0.0) # row sum tavg = sum(cavg)/(self.n+0.0) # total sum # B[row][column] for i in xrange(self.n): for j in x... |
f = sqrt(distnorm/sum) | f = sqrt(distnorm/max(sum,1e-6)) | def LSMT(self): # optimize the distance transformation # build vector o effect = 0 self.getDistance() o = [] for i in xrange(1,self.n): for j in xrange(i): o.append((self.originalDistances[i,j],(i,j))) o.sort(_mycompare) # find the ties in o, and construct the d vector sorting in order within ties d = [] td = [] uv = [... |
else: self.DrawData(tempData, attrList[1:], (x0+currPos, x0+currPos+size), (y0, y1), side +1, condition + 4*"   " + "<b>" + attr + ":</b> " + val + "<br>", totalAttrs, lastValueForFirstAttribute + (side%2==0 and val == vals[-1]), usedAttrs + [attr, val]) | else: self.DrawData(tempData, attrList[1:], (x0+currPos, x0+currPos+size), (y0, y1), side +1, condition + 4*"   " + "<b>" + attr + ":</b> " + val + "<br>", totalAttrs, lastValueForFirstAttribute + (val == vals[-1]), usedAttrs + [attr, val]) | def DrawData(self, data, attrList, (x0, x1), (y0, y1), side, condition, totalAttrs, lastValueForFirstAttribute = 0, usedAttrs = []): if len(data) == 0: self.addRect(x0, x1, y0, y1, None) self.DrawText(data, side, attrList[0], (x0, x1), (y0, y1), totalAttrs, lastValueForFirstAttribute) # store coordinates for later dra... |
else: self.DrawData(tempData, attrList[1:], (x0, x1), (y0+currPos, y0+currPos+size), side +1, condition + 4*"   " + "<b>" + attr + ":</b> " + val + "<br>", totalAttrs, lastValueForFirstAttribute + (side%2==0 and val == vals[-1]), usedAttrs + [attr, val]) | else: self.DrawData(tempData, attrList[1:], (x0, x1), (y0+currPos, y0+currPos+size), side +1, condition + 4*"   " + "<b>" + attr + ":</b> " + val + "<br>", totalAttrs, lastValueForFirstAttribute, usedAttrs + [attr, val]) | def DrawData(self, data, attrList, (x0, x1), (y0, y1), side, condition, totalAttrs, lastValueForFirstAttribute = 0, usedAttrs = []): if len(data) == 0: self.addRect(x0, x1, y0, y1, None) self.DrawText(data, side, attrList[0], (x0, x1), (y0, y1), totalAttrs, lastValueForFirstAttribute) # store coordinates for later dra... |
if side == RIGHT and lastValueForFirstAttribute != 2: return | def DrawText(self, data, side, attr, (x0, x1), (y0, y1), totalAttrs, lastValueForFirstAttribute): if self.drawnSides[side]: return if not data or len(data) == 0: if not self.drawPositions.has_key(side): self.drawPositions[side] = (x0, x1, y0, y1) return else: if self.drawPositions.has_key(side): (x0, x1, y0, y1) = self... | |
else: self.setAxisAutoScale(QwtPlot.xBottom) | else: self.setXlabels(None) | def updateData(self, xAttr, yAttr, colorAttr, shapeAttr = "", sizeShapeAttr = "", showColorLegend = 0, **args): self.removeDrawingCurves() # my function, that doesn't delete selection curves self.removeMarkers() self.tips.removeAll() #self.enableLegend(0) self.removeTooltips() self.tooltipData = [] |
else: self.setAxisAutoScale(QwtPlot.yLeft) | else: self.setYLlabels(None) | def updateData(self, xAttr, yAttr, colorAttr, shapeAttr = "", sizeShapeAttr = "", showColorLegend = 0, **args): self.removeDrawingCurves() # my function, that doesn't delete selection curves self.removeMarkers() self.tips.removeAll() #self.enableLegend(0) self.removeTooltips() self.tooltipData = [] |
return math.pow(self.wrapped(example1, example2), degree) | return math.pow(self.wrapped(example1, example2), self.degree) | def __call__(self, example1, example2): return math.pow(self.wrapped(example1, example2), degree) |
results = orngTest.ExperimentResults(1, ["kNN"], list(table.domain.classVar.values), 0, table.domain.classVar.baseValue) results.results = [orngTest.TestedExample(i, int(table[i].getclass()), 1) for i in range(len(table))] classifier = knn(table) for i in range(len(table)): cls, pro = classifier(table[i], orange.GetBot... | results = orngTest.ExperimentResults(1, ["kNN"], list(testTable.domain.classVar.values), 0, testTable.domain.classVar.baseValue) results.results = [orngTest.TestedExample(i, int(testTable[i].getclass()), 1) for i in range(len(testTable))] classifier = knn(testTable) for i in range(len(testTable)): cls, pro = classifier... | def kNNComputeAccuracy(self, table): # select a subset of the data if necessary percentDataUsed = int(str(self.percentDataUsedCombo.currentText())) if percentDataUsed != 100: indices = orange.MakeRandomIndices2(table, 1.0-float(percentDataUsed)/100.0) testTable = table.select(indices) else: testTable = table #qApp.pro... |
currentClassDistribution = orange.Distribution(table.domain.classVar, table) prediction = [0.0 for i in range(len(table.domain.classVar.values))] | currentClassDistribution = orange.Distribution(testTable.domain.classVar, testTable) prediction = [0.0 for i in range(len(testTable.domain.classVar.values))] | def kNNComputeAccuracy(self, table): # select a subset of the data if necessary percentDataUsed = int(str(self.percentDataUsedCombo.currentText())) if percentDataUsed != 100: indices = orange.MakeRandomIndices2(table, 1.0-float(percentDataUsed)/100.0) testTable = table.select(indices) else: testTable = table #qApp.pro... |
if table.domain.classVar.varType == orange.VarTypes.Discrete: | if testTable.domain.classVar.varType == orange.VarTypes.Discrete: | def kNNComputeAccuracy(self, table): # select a subset of the data if necessary percentDataUsed = int(str(self.percentDataUsedCombo.currentText())) if percentDataUsed != 100: indices = orange.MakeRandomIndices2(table, 1.0-float(percentDataUsed)/100.0) testTable = table.select(indices) else: testTable = table #qApp.pro... |
acc = sum(prediction) / float(len(table)) | acc = sum(prediction) / float(len(testTable)) | def kNNComputeAccuracy(self, table): # select a subset of the data if necessary percentDataUsed = int(str(self.percentDataUsedCombo.currentText())) if percentDataUsed != 100: indices = orange.MakeRandomIndices2(table, 1.0-float(percentDataUsed)/100.0) testTable = table.select(indices) else: testTable = table #qApp.pro... |
self.values = distrlist | self.values = distrlist self.metric = metric def bic(self): return _bic(self.values, self.mapping, self.medoids, self.k) | def __init__(self, distrlist,k,metric=2): assert(metric == 1 or metric == 2) if (len(distrlist) > k): (a,b,c,d,e,f) = orngCRS.MCluster(distrlist,k,metric) self.n = a self.k = b self.mapping = c self.medoids = d self.cdisp = e self.disp = f else: self.n = len(distrlist) self.k = self.n self.mapping = range(1,self.n+1) s... |
def __init__(self, diss,k): if len(diss) <= k-1: self.n = len(distrlist)+1 self.k = self.n self.mapping = range(1,self.n+1) self.medoids = range(1,self.n+1) self.cdisp = [0]*self.n self.disp = 0 self.values = distrlist else: (a,b,c,d,e,f) = orngCRS.DMCluster(diss,k) self.n = a self.k = b self.mapping = c self.medoids =... | def __init__(self, diss,k): if len(diss) <= k-1: self.n = len(diss)+1 self.k = self.n self.mapping = range(1,self.n+1) self.medoids = range(1,self.n+1) self.cdisp = [0]*self.n self.disp = 0 self.values = diss else: (a,b,c,d,e,f) = orngCRS.DMCluster(diss,k) self.n = a self.k = b self.mapping = c self.medoids = d self.cd... | def __init__(self, diss,k): if len(diss) <= k-1: #len = 1 if two elements ---- then k can be 2 or less self.n = len(distrlist)+1 self.k = self.n self.mapping = range(1,self.n+1) self.medoids = range(1,self.n+1) self.cdisp = [0]*self.n self.disp = 0 self.values = distrlist else: (a,b,c,d,e,f) = orngCRS.DMCluster(diss,k)... |
if self.kValueFormula == 0: self.kValue = int(sqrt(len(data))) elif self.kValueFormula == 1: self.kValue = int(len(data) / len(data.domain.classVar.values)) | if data.domain.classVar.varType == orange.VarTypes.Discrete: if self.kValueFormula == 0: self.kValue = int(sqrt(len(data))) elif self.kValueFormula == 1: self.kValue = int(len(data) / len(data.domain.classVar.values)) else: self.kValue = 10 | def setData(self, data): self.data = data |
print "CONTEXT FOUND" | def openContext(self, widget, *arg, **argkw): if not hasattr(widget, self.localContextName): | |
print "TAKING GLOBAL" | def openContext(self, widget, *arg, **argkw): if not hasattr(widget, self.localContextName): | |
print "COPYING GLOBAL" | def openContext(self, widget, *arg, **argkw): if not hasattr(widget, self.localContextName): | |
self.moveContextUp(widget, index) | print "index", index if index < 0: print "add context" self.addContext(widget, context) else: print "context up" self.moveContextUp(widget, index) | def openContext(self, widget, *arg, **argkw): if not hasattr(widget, self.localContextName): |
result = rstrip(report.readline()) | result = rstrip(report.readline()) or "crash" | def testScripts(complete): global error_status if sys.platform == "win32" and sys.executable[-6:].upper() != "_D.EXE": import win32process, win32api win32process.SetPriorityClass(win32api.GetCurrentProcess(), 64) skip = ["buildC45.py"] for dir in os.listdir("."): if not os.path.isdir(dir) or dir in ["cvs", "datasets",... |
results = ["OK", "changed", "random", "error"] | results = ["OK", "changed", "random", "error", "crash"] | def testScripts(complete): global error_status if sys.platform == "win32" and sys.executable[-6:].upper() != "_D.EXE": import win32process, win32api win32process.SetPriorityClass(win32api.GetCurrentProcess(), 64) skip = ["buildC45.py"] for dir in os.listdir("."): if not os.path.isdir(dir) or dir in ["cvs", "datasets",... |
else: result = "crash" error_status = 4 | def testScripts(complete): global error_status if sys.platform == "win32" and sys.executable[-6:].upper() != "_D.EXE": import win32process, win32api win32process.SetPriorityClass(win32api.GetCurrentProcess(), 64) skip = ["buildC45.py"] for dir in os.listdir("."): if not os.path.isdir(dir) or dir in ["cvs", "datasets",... | |
apply(self.method, k) signalManager.signalProcessingInProgress -= 1 if not signalManager.signalProcessingInProgress: signalManager.processNewSignals(self.widget) | try: apply(self.method, k) finally: signalManager.signalProcessingInProgress -= 1 if not signalManager.signalProcessingInProgress: signalManager.processNewSignals(self.widget) | def __call__(self, *k): signalManager.signalProcessingInProgress += 1 apply(self.method, k) signalManager.signalProcessingInProgress -= 1 if not signalManager.signalProcessingInProgress: signalManager.processNewSignals(self.widget) |
self.leNu = OWGUI.lineEdit(methodOptions, self, "nu", " Fraction (nu): ", orientation="horizontal", validator = nuValid, labelWidth = labwidth) | self.leNu = OWGUI.lineEdit(methodOptions, self, "nu", " Complexity bound (nu): ", orientation="horizontal", validator = nuValid, labelWidth = labwidth) | def __init__(self, parent=None, signalManager = None, name='Support Vector Machine'): OWWidget.__init__(self, parent, signalManager, name) |
print "" | print "Preparing filename masks...", for root, dirs, files in os.walk(OrangeInstallDir): for name in files: if name in OrangeLibList: os.chmod(os.path.join(root,name), S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH) else: os.chmod(os.path.join(root,name), S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH) for name in d... | def run(self): install.run(self) |
OrangeCanvasIcons)] | OrangeCanvasIcons), (os.path.join(OrangeInstallDir, "OrangeCanvas"), OrangeCanvasPyw)] | def run(self): install.run(self) |
self.evaluationData["index"] = 0 | def selectNextAttributeSubset(self, minLength, maxLength): z = self.evaluationData.get("z", minLength-1) u = self.evaluationData.get("u", minLength-1) self.evaluationData["combinations"] = [] | |
while placed < attrCount: | while placed < min(attrCount, len(self.data.domain.attributes)): | def getAttributeSubsetUsingGammaDistribution(self, attrCount): maxTries = 50 triedDict = self.evaluationData.get("triedCombinations", {}) if self.useHeuristicToFindAttributeOrders: numClasses = len(self.data.domain.classVar.values) attributes, attrsByClass = self.evaluationData["attrs"] for i in range(maxTries): attrL... |
if not triedDict.has_key(tuple(attrs)): | if not triedDict.has_key(tuple(attrs)) and len(attrs) == attrCount: | def getAttributeSubsetUsingGammaDistribution(self, attrCount): maxTries = 50 triedDict = self.evaluationData.get("triedCombinations", {}) if self.useHeuristicToFindAttributeOrders: numClasses = len(self.data.domain.classVar.values) attributes, attrsByClass = self.evaluationData["attrs"] for i in range(maxTries): attrL... |
while self.selectNextAttributeSubset(minLength, maxLength) != None: | newProjectionsExist = 1 while newProjectionsExist: for experiment in range(maxLength-minLength+1): if self.selectNextAttributeSubset(minLength, maxLength) != None: break newProjectionsExist = 0 | def evaluateProjections(self): evaluatedProjections = 0 self.startTime = time.time() self.evaluationData = {} # clear all previous data about tested permutations and stuff |
QMessageBox.information( None, "Orange Canvas", "Unable to modify signals while signal processing is in progress. Please wait.", QMessageBox.Ok + QMessageBox.Default ) | QMessageBox.information( None, "Orange Canvas", "Please wait until Orange finishes processing signals.", QMessageBox.Ok + QMessageBox.Default ) | def contentsMouseDoubleClickEvent(self, ev): rect = QRect(ev.pos().x()-3, ev.pos().y()-3,6,6) activeItems = self.canvas().collisions(rect) widget = self.findFirstItemType(activeItems, orngCanvasItems.CanvasWidget) line = self.findFirstItemType(activeItems, orngCanvasItems.CanvasLine) if widget: self.tempWidget = widg... |
self.textOutput.append(text) | self.textOutput.append(str(text)) | def write(self, text): if self.focusOnCatchOutput: self.canvasDlg.menuItemShowOutputWindow() self.textOutput.append(text) self.textOutput.ensureVisible(0, self.textOutput.contentsHeight()) if self.printOutput: self.canvasDlg.setStatusBarEvent(text) |
self.canvasDlg.setStatusBarEvent(text) | self.canvasDlg.setStatusBarEvent(str(text)) def writelines(self, lines): for line in lines: self.write(line) def flush(self): pass | def write(self, text): if self.focusOnCatchOutput: self.canvasDlg.menuItemShowOutputWindow() self.textOutput.append(text) self.textOutput.ensureVisible(0, self.textOutput.contentsHeight()) if self.printOutput: self.canvasDlg.setStatusBarEvent(text) |
master._guiElements = getattr(master, "_guiElements", []) + [("spin", wa, value, min, max, 1, callback )] | master._guiElements = getattr(master, "_guiElements", []) + [("spin", wa, value, min, max, step, callback )] | def spin(widget, master, value, min, max, step=1, box=None, label=None, labelWidth=None, orientation=None, tooltip=None, callback=None, debuggingEnabled = 1): b = widgetBox(widget, box, orientation) widgetLabel(b, label, labelWidth) wa = QSpinBox(min, max, step, b) wa.setValue(mygetattr(master, value)) if tooltip: QTo... |
master._guiElements = getattr(master, "_guiElements", []) + [("spin", wb, value, spinCallback, min, max, spinCallback)] | master._guiElements = getattr(master, "_guiElements", []) + [("spin", wb, value, min, max, step, spinCallback )] | def checkWithSpin(widget, master, label, min, max, checked, value, posttext = None, step = 1, tooltip=None, checkCallback=None, spinCallback=None, getwidget=None, labelWidth=None, debuggingEnabled = 1): hb = QHBox(widget) wa = checkBox(hb, master, checked, label, callback = checkCallback, labelWidth = labelWidth) wb =... |
def comboBoxWithCaption(widget, master, value, label, box=None, items=None, tooltip=None, callback = None, sendSelectedValue=0, valueType = int, labelWidth = None): | def comboBoxWithCaption(widget, master, value, label, box=None, items=None, tooltip=None, callback = None, sendSelectedValue=0, valueType = int, labelWidth = None, debuggingEnabled = 1): | def comboBoxWithCaption(widget, master, value, label, box=None, items=None, tooltip=None, callback = None, sendSelectedValue=0, valueType = int, labelWidth = None): hbox = widgetBox(widget, box = box, orientation="horizontal") lab = widgetLabel(hbox, label, labelWidth) combo = comboBox(hbox, master, value, items = item... |
combo = comboBox(hbox, master, value, items = items, tooltip = tooltip, callback = callback, sendSelectedValue = sendSelectedValue, valueType = valueType) | combo = comboBox(hbox, master, value, items = items, tooltip = tooltip, callback = callback, sendSelectedValue = sendSelectedValue, valueType = valueType, debuggingEnabled = debuggingEnabled) | def comboBoxWithCaption(widget, master, value, label, box=None, items=None, tooltip=None, callback = None, sendSelectedValue=0, valueType = int, labelWidth = None): hbox = widgetBox(widget, box = box, orientation="horizontal") lab = widgetLabel(hbox, label, labelWidth) combo = comboBox(hbox, master, value, items = item... |
if not self.attrValues.has_key(attr.name): self.attrValues[attr.name] = [0, len(attr.values)-1] | if not self.attrValues.has_key(attr.name): self.attrValues[attr.name] = [0, len(attr.values)] | def setData(self, data, keepMinMaxVals = 0): # clear all curves, markers, tips self.removeAllSelections(0) # clear all selections self.removeCurves() self.removeMarkers() self.tips.removeAll() self.attributeFlipInfo = {} if not keepMinMaxVals or self.globalValueScaling == 1: self.attrValues = {} self.rawdata = data |
f.write('"%s" = ordered(levels=c('%(labels[i])) for j in xrange(len(as[i].values)): f.write('"%s"'%(as[i].values[j])) if j == len(as[i].values)-1: f.write('),c(') else: f.write(',') | f.write('"%s" = ordered('%labels[i]) | def toR(filename,t): if string.upper(filename[-2:]) == ".R": filename = filename[:-2] f = open(filename+'.R','w') atyp = [] aord = [] labels = [] as = [] for a in t.domain.attributes: as.append(a) as.append(t.domain.classVar) for a in as: labels.append(str(a.name)) atyp.append(a.varType) aord.append(a.ordered) f.writ... |
f.write('"%s" = factor(c('%(labels[i])) | f.write('"%s" = factor('%labels[i]) f.write('levels=c('%(labels[i])) for j in xrange(len(as[i].values)): f.write('"x%s"'%(as[i].values[j])) if j == len(as[i].values)-1: f.write('),c(') else: f.write(',') | def toR(filename,t): if string.upper(filename[-2:]) == ".R": filename = filename[:-2] f = open(filename+'.R','w') atyp = [] aord = [] labels = [] as = [] for a in t.domain.attributes: as.append(a) as.append(t.domain.classVar) for a in as: labels.append(str(a.name)) atyp.append(a.varType) aord.append(a.ordered) f.writ... |
f.write('"%s"'%str(t[j][i])) | f.write('"x%s"'%str(t[j][i])) | def toR(filename,t): if string.upper(filename[-2:]) == ".R": filename = filename[:-2] f = open(filename+'.R','w') atyp = [] aord = [] labels = [] as = [] for a in t.domain.attributes: as.append(a) as.append(t.domain.classVar) for a in as: labels.append(str(a.name)) atyp.append(a.varType) aord.append(a.ordered) f.writ... |
if contexts: | if contexts != False: | def loadSettings(self, file = None): file = self.getSettingsFile(file) if file: try: settings = cPickle.load(file) except: settings = None |
def randomlyChangeSettings(self, extraOutput = 0): | def randomlyChangeSettings(self): | def randomlyChangeSettings(self, extraOutput = 0): if len(self._guiElements) == 0: return index = random.randint(0, len(self._guiElements)-1) type, widget = self._guiElements[index][0], self._guiElements[index][1] if not widget.isEnabled(): return |
if extraOutput: self.signalManager.addEvent("Changing widget %s: %s" % (str(self), str(self._guiElements[index]))) try: if type == "checkBox": type, widget, value, callback = self._guiElements[index] setattr(self, value, not mygetattr(self, value)) | if type == "checkBox": type, widget, value, callback = self._guiElements[index] setattr(self, value, not mygetattr(self, value)) if callback: callback() elif type == "button": type, widget, callback = self._guiElements[index] if widget.isToggleButton(): widget.setOn(not widget.isOn()) if callback: callback() elif type ... | def randomlyChangeSettings(self, extraOutput = 0): if len(self._guiElements) == 0: return index = random.randint(0, len(self._guiElements)-1) type, widget = self._guiElements[index][0], self._guiElements[index][1] if not widget.isEnabled(): return |
elif type == "button": type, widget, callback = self._guiElements[index] if widget.isToggleButton(): widget.setOn(not widget.isOn()) | elif type == "radioButtonsInBox": type, widget, value, callback = self._guiElements[index] radioIndex = random.randint(0, len(widget.buttons)-1) if widget.buttons[radioIndex].isEnabled(): setattr(self, value, radioIndex) | def randomlyChangeSettings(self, extraOutput = 0): if len(self._guiElements) == 0: return index = random.randint(0, len(self._guiElements)-1) type, widget = self._guiElements[index][0], self._guiElements[index][1] if not widget.isEnabled(): return |
elif type == "listBox": type, widget, value, callback = self._guiElements[index] if widget.count(): itemIndex = random.randint(0, widget.count()-1) widget.setSelected(itemIndex, not widget.isSelected(itemIndex)) if callback: callback() elif type == "radioButtonsInBox": type, widget, value, callback = self._guiElements[... | elif type == "radioButton": type, widget, value, callback = self._guiElements[index] setattr(self, value, not mygetattr(self, value)) if callback: callback() elif type in ["hSlider", "qwtHSlider", "spin"]: type, widget, value, min, max, step, callback = self._guiElements[index] currentValue = mygetattr(self, value) if ... | def randomlyChangeSettings(self, extraOutput = 0): if len(self._guiElements) == 0: return index = random.randint(0, len(self._guiElements)-1) type, widget = self._guiElements[index][0], self._guiElements[index][1] if not widget.isEnabled(): return |
callback() elif type in ["hSlider", "qwtHSlider", "spin"]: type, widget, value, min, max, step, callback = self._guiElements[index] currentValue = mygetattr(self, value) if currentValue == min: setattr(self, value, currentValue+step) elif currentValue == max: setattr(self, value, currentValue-step) else: ... | callback() | def randomlyChangeSettings(self, extraOutput = 0): if len(self._guiElements) == 0: return index = random.randint(0, len(self._guiElements)-1) type, widget = self._guiElements[index][0], self._guiElements[index][1] if not widget.isEnabled(): return |
if issubclass(eval(inType), eval(outType)): canConnect = 1 if outName == inName and issubclass(eval(inType), eval(outType)): | if issubclass(eval(outType), eval(inType)): canConnect = 1 if outName == inName and issubclass(eval(outType), eval(inType)): | def addDefaultLinks(self): canConnect = 0 for (outName, outType) in self.outList: try: eval(outType) for (inName, inType, handler, single) in self.inList: try: eval(inType) if issubclass(eval(inType), eval(outType)): canConnect = 1 if outName == inName and issubclass(eval(inType), eval(outType)): self.addLink(outName, ... |
if not issubclass(eval(inType), eval(outType)): return 0 | if not issubclass(eval(outType), eval(inType)): return 0 | def addLink(self, outName, inName): if (outName, inName) in self._links: return |
self.multiplePossibleConnections = (same[can.index(1)] != 1) | self.multiplePossibleConnections = (same[can.index(1)] != 1 and sum(can) > 1) | def addDefaultLinks(self): canConnect = 0 addedInLinks = [] addedOutLinks = [] self.multiplePossibleConnections = 0 # can we connect some signal with more than one widget |
self.resize(310,450) | self.resize(310,500) | def __init__(self, parentWidget = None, signalManager = None, graph = None, parentName = "Visualization widget"): OWBaseWidget.__init__(self, None, signalManager, "FreeViz Dialog") |
validData = [1] * dataSize | validData = self.getValidList(indices + [self.attributeNames.index(self.rawdata.domain.classVar.name)]) | def updateData(self, attributes, targetValue, midLabels = None): #self.removeCurves() self.removeDrawingCurves() # my function, that doesn't delete selection curves self.removeTooltips() self.removeMarkers() |
valid = 1 for index in indices: if self.scaledData[index][i] == "?": validData[i] = 0; break; | def updateData(self, attributes, targetValue, midLabels = None): #self.removeCurves() self.removeDrawingCurves() # my function, that doesn't delete selection curves self.removeTooltips() self.removeMarkers() | |
self.discListbox.insertItem(self.discListbox.pixmap(i), self.discListbox.text(i-1), i-1) | pixI, textI = self.discListbox.pixmap(i-1), self.discListbox.text(i) pixII, textII = self.discListbox.pixmap(i), self.discListbox.text(i-1) self.discListbox.insertItem(pixI, textI, i-1) self.discListbox.insertItem(pixII, textII, i-1) self.discListbox.removeItem(i+1) | def moveAttrUP(self): for i in range(1, self.discListbox.count()): if self.discListbox.isSelected(i): self.discListbox.insertItem(self.discListbox.pixmap(i), self.discListbox.text(i-1), i-1) self.discListbox.removeItem(i+1) self.discListbox.setSelected(i-1, TRUE) self.discreteColors.insert(i-1, self.discreteColors.pop(... |
self.discListbox.insertItem(self.discListbox.pixmap(i), self.discListbox.text(i+2), i+2) self.discListbox.removeItem(i) | pixI, textI = self.discListbox.pixmap(i+1), self.discListbox.text(i) pixII, textII = self.discListbox.pixmap(i), self.discListbox.text(i+1) self.discListbox.insertItem(pixI, textI, i) self.discListbox.insertItem(pixII, textII, i+1) self.discListbox.removeItem(i+2) self.discListbox.removeItem(i+2) | def moveAttrDOWN(self): count = self.discListbox.count() for i in range(count-2,-1,-1): if self.discListbox.isSelected(i): self.discListbox.insertItem(self.discListbox.pixmap(i), self.discListbox.text(i+2), i+2) self.discListbox.removeItem(i) self.discListbox.setSelected(i+1, TRUE) self.discreteColors.insert(i+1, self.... |
return OWGraphTools.ColorPaletteGenerator([(c.red(), c.green(), c.blue()) for c in self.discreteColors]) | return OWGraphTools.ColorPaletteGenerator(rgbColors = [(c.red(), c.green(), c.blue()) for c in self.discreteColors]) | def getDiscretePalette(self): return OWGraphTools.ColorPaletteGenerator([(c.red(), c.green(), c.blue()) for c in self.discreteColors]) |
self.catData.select(attrlist) self.odata = OrangeData(self.catData) | self.newData = self.catData.select(attrlist) self.odata = OrangeData(self.newData) | def categorize(self): if self.dataset == None: return |
self.originalData = arr.filled(1e20) | arr = Numeric.array(arr.filled(1e20)) self.originalData = arr | def setData(self, data, keepMinMaxVals = 0): # clear all curves, markers, tips self.removeAllSelections(0) # clear all selections self.removeCurves() self.removeMarkers() self.tips.removeAll() self.attributeFlipInfo = {} if not keepMinMaxVals or self.globalValueScaling == 1: self.attrValues = {} self.rawdata = data ... |
self.scaledData[index] = arr[index].filled(1e20) + (self.jitterSize/(50.0*count))*(RandomArray.random(len(data)) - 0.5) | self.scaledData[index] = arr[index] + (self.jitterSize/(50.0*count))*(RandomArray.random(len(data)) - 0.5) | def setData(self, data, keepMinMaxVals = 0): # clear all curves, markers, tips self.removeAllSelections(0) # clear all selections self.removeCurves() self.removeMarkers() self.tips.removeAll() self.attributeFlipInfo = {} if not keepMinMaxVals or self.globalValueScaling == 1: self.attrValues = {} self.rawdata = data ... |
self.scaledData[index] = line.filled(1e20) | self.scaledData[index] = line | def setData(self, data, keepMinMaxVals = 0): # clear all curves, markers, tips self.removeAllSelections(0) # clear all selections self.removeCurves() self.removeMarkers() self.tips.removeAll() self.attributeFlipInfo = {} if not keepMinMaxVals or self.globalValueScaling == 1: self.attrValues = {} self.rawdata = data ... |
self.scaledData[index] = arr[index].filled(1e20) self.noJitteringScaledData = arr.filled(1e20) | self.scaledData[index] = arr[index] self.noJitteringScaledData = arr | def setData(self, data, keepMinMaxVals = 0): # clear all curves, markers, tips self.removeAllSelections(0) # clear all selections self.removeCurves() self.removeMarkers() self.tips.removeAll() self.attributeFlipInfo = {} if not keepMinMaxVals or self.globalValueScaling == 1: self.attrValues = {} self.rawdata = data ... |
def getShortExampleText(self, data, example, indices): | def getExampleTextWithMeta(self, data, example, indices): | def getShortExampleText(self, data, example, indices): text = "" try: for index in indices: if example[index].isSpecial(): text += "%s = ?; " % (data.domain[index].name) else: text += "%s = %s; " % (data.domain[index].name, str(example[index])) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.