rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
ContextField("scene.component", DomainContextHandler.Optional), ContextField("scene.includeCodebook", DomainContextHandler.Optional)])} | ContextField("component", DomainContextHandler.Optional), ContextField("includeCodebook", DomainContextHandler.Optional)])} | def updateToolTips(self, *args, **kwargs): for item in self.somWidgets(): item.somItem.updateToolTips(*args, **kwargs) |
OWGUI.separator(db, 4) | def __init__(self,parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "FeatureConstructor") | |
vb = OWGUI.widgetBox(hb, None, "vertical") self.leAttrName = OWGUI.lineEdit(vb, self, "attrname", "New attribute") OWGUI.rubber(vb) OWGUI.separator(hb, 8, 8) vb = OWGUI.widgetBox(hb, None, "vertical") | hbv = OWGUI.widgetBox(hb) self.leAttrName = OWGUI.lineEdit(hbv, self, "attrname", "New attribute") OWGUI.rubber(hbv) vb = OWGUI.widgetBox(hb, None, "vertical", addSpace=True) | def __init__(self,parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "FeatureConstructor") |
self.cbFuncs = OWGUI.comboBox(hhb, self, "selectedFunc", items = ["(all functions)"] + [m for m in math.__dict__.keys() if m[:2]!="__"], callback = self.funcListSelected) OWGUI.separator(hb, 8, 8) OWGUI.button(hb, self, "Clear", callback = self.clearLineEdits) OWGUI.separator(db) hb = OWGUI.widgetBox(db, None, "hori... | self.cbFuncs = OWGUI.comboBox(hhb, self, "selectedFunc", items = ["(all functions)"] + sorted(m for m in math.__dict__.keys() if m[:2]!="__"), callback = self.funcListSelected) hb = OWGUI.widgetBox(db, None, "horizontal", addSpace=True) | def __init__(self,parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "FeatureConstructor") |
OWGUI.separator(db) | def __init__(self,parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, "FeatureConstructor") | |
def clearLineEdits(self): self.expression = self.attrname = "" def addAttr(self): | def getAttrExpression(self, thisRow=-1): | def setData(self, data): self.closeContext() self.data = data self.cbAttrs.clear() self.cbAttrs.addItem("(all attributes)") if self.data: self.cbAttrs.addItems([attr.name for attr in self.data.domain]) |
for row, (attr, expr) in enumerate(self.definitions): if row!=thisRow and attr==attrname: QMessageBox.critical(self, "Duplicate name", "Attribute with that name already exists.\nPlease choose a different name.") self.leAttrName.setFocus() return | def addAttr(self): attrname = self.attrname.strip() if not attrname: self.leAttrName.setFocus() return | |
self.defLabels = self.defLabels + ["%s := %s" % (attrname, expression)] self.definitions.append((attrname, expression)) | return attrname, expression def addAttr(self): attrexpr = self.getAttrExpression() if not attrexpr: return self.defLabels = self.defLabels + ["%s := %s" % attrexpr] self.definitions.append(attrexpr) | def addAttr(self): attrname = self.attrname.strip() if not attrname: self.leAttrName.setFocus() return |
self.clearLineEdits() | self.expression = "" | def removeAllAttr(self): self.defLabels = [] self.definitions = [] self.selectedDef = [] self.clearLineEdits() self.applyIf() |
def updateAttr(self): | def selectAttr(self): | def removeAllAttr(self): self.defLabels = [] self.definitions = [] self.selectedDef = [] self.clearLineEdits() self.applyIf() |
selected = self.selectedDef[0] if 0 <= selected < self.lbDefinitions.count(): self.defLabels = self.defLabels[:selected] + ["%s := %s" % (self.attrname, self.expression)] + self.defLabels[selected+1:] self.definitions[selected] = (self.attrname, self.expression) self.applyIf() def selectAttr(self): selected = self.se... | self.attrname, self.expression = self.definitions[self.selectedDef[0]] | def updateAttr(self): if self.selectedDef: selected = self.selectedDef[0] if 0 <= selected < self.lbDefinitions.count(): self.defLabels = self.defLabels[:selected] + ["%s := %s" % (self.attrname, self.expression)] + self.defLabels[selected+1:] self.definitions[selected] = (self.attrname, self.expression) self.applyIf() |
if self.leExpression.hasMarkedText(): self.leExpression.delChar() | if self.leExpression.hasSelectedText(): self.leExpression.del_() | def insertIntoExpression(self, what): if self.leExpression.hasMarkedText(): self.leExpression.delChar() |
attr = str(self.cbAttrs.text(self.selectedAttr)) | attr = str(self.cbAttrs.itemText(self.selectedAttr)) | def attrListSelected(self): if self.selectedAttr: attr = str(self.cbAttrs.text(self.selectedAttr)) mo = re_identifier.match(attr) if not mo or mo.span()[1] != len(attr): attr = '"%s"' % attr |
func = str(self.cbFuncs.text(self.selectedFunc)) | print self.selectedFunc func = str(self.cbFuncs.itemText(self.selectedFunc)) | def funcListSelected(self): if self.selectedFunc: func = str(self.cbFuncs.text(self.selectedFunc)) if func in ["atan2", "fmod", "ldexp", "log", "pow"]: self.insertIntoExpression(func + "(,)") self.leExpression.cursorLeft(False, 2) elif func == "pi": self.insertIntoExpression(func) else: self.insertIntoExpression(func +... |
self.leExpression.cursorLeft(False, 2) elif func == "pi": | self.leExpression.cursorBackward(False, 2) elif func in ["e", "pi"]: | def funcListSelected(self): if self.selectedFunc: func = str(self.cbFuncs.text(self.selectedFunc)) if func in ["atan2", "fmod", "ldexp", "log", "pow"]: self.insertIntoExpression(func + "(,)") self.leExpression.cursorLeft(False, 2) elif func == "pi": self.insertIntoExpression(func) else: self.insertIntoExpression(func +... |
self.leExpression.cursorLeft(False) | self.leExpression.cursorBackward(False) | def funcListSelected(self): if self.selectedFunc: func = str(self.cbFuncs.text(self.selectedFunc)) if func in ["atan2", "fmod", "ldexp", "log", "pow"]: self.insertIntoExpression(func + "(,)") self.leExpression.cursorLeft(False, 2) elif func == "pi": self.insertIntoExpression(func) else: self.insertIntoExpression(func +... |
learner=orngTree.TreeLearner(mesure="retis", | learner=orngTree.TreeLearner(measure="retis", | def setLearner(self): learner=orngTree.TreeLearner(mesure="retis", binarization=self.Bin, mForPruning=self.PostMPCheck and self.PostMPVal, minExamples=self.MinNodeCheck and self.MinNodeVal, storeExamples=1) if self.preprocessor: learner = self.preprocessor.wrapLearner(learner) learner.name=self.Name self.send("Learner"... |
if len(labels) < 3: return | if len(labels) < 3: self.replot() return | def updateData(self, data, labels, probabilities): self.clear() self.tips.removeAll() |
if abs(pearson) < self.minPearson: return | if abs(pearson) <= self.minPearson: return | def addLinePearson(self, xDataList, yDataList, countX, countY, actual, sum): expected = float(countX*countY)/float(sum) if actual == expected == 0: return elif expected == 0: # if expected == 0 we have to solve division by zero. In reverse example (when actual == 0) pearson = -expected/sqrt(expected) pearson = actu... |
box = OWGUI.widgetBox(self.controlArea, "Clusters (k)", addSpace=True) | box = OWGUI.widgetBox(self.controlArea, "Clusters (k)", addSpace=True, spacing=0) left, top, right, bottom = box.getContentsMargins() | def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, 'k-Means Clustering') |
fixedBox = OWGUI.widgetBox(box, orientation="horizontal") | fixedBox = OWGUI.widgetBox(box, orientation="horizontal", margin=0, spacing=bg.layout().spacing()) | def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, 'k-Means Clustering') |
OWGUI.rubber(fixedBox) optimizedBox = OWGUI.widgetBox(box) | optimizedBox = OWGUI.widgetBox(box, margin=0, spacing=bg.layout().spacing()) | def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, 'k-Means Clustering') |
option = QStyleOptionButton() option.initFrom(button) box = OWGUI.indentedBox(optimizedBox, qApp.style().subElementRect(QStyle.SE_CheckBoxIndicator, option, button).width() - 3) | box = OWGUI.indentedBox(optimizedBox, sep=OWGUI.checkButtonOffsetHint(button)) box.layout().setSpacing(0) | def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, 'k-Means Clustering') |
box = OWGUI.indentedBox(box) | box = OWGUI.indentedBox(box, sep=OWGUI.checkButtonOffsetHint(cb)) | def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, 'k-Means Clustering') |
self.table.hide() | def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, 'k-Means Clustering') | |
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) | self.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) | def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, 'k-Means Clustering') |
state = [True, False, False] if self.optimized else [False, True, True] for s, func in zip(state, [self.fixedSpinBox.setDisabled, self.optimizationBox.setDisabled, self.mainArea.setHidden]): func(s) qApp.processEvents() self.adjustSize() | self.fixedSpinBox.setDisabled(bool(self.optimized)) self.optimizationBox.setDisabled(not bool(self.optimized)) if self.optimized: self.showOptResults() else: self.hideOptResults() | def updateOptimizationGui(self): state = [True, False, False] if self.optimized else [False, True, True] for s, func in zip(state, [self.fixedSpinBox.setDisabled, self.optimizationBox.setDisabled, self.mainArea.setHidden]): func(s) qApp.processEvents() self.adjustSize() |
matrix = [[e for e in row for row in matrix]] r_obj = Matrix(matrix) | v = robjects.FloatVector([e for row in matrix for e in row]) r_obj = robjects.r['matrix'](v, nrow=matrix.dim) | def SymMatrix_to_Matrix(matrix): matrix = [[e for e in row for row in matrix]] r_obj = Matrix(matrix) return r_obj |
self.lastDir = os.path.expanduser("~/") | self.lastDir = os.path.expanduser("~/script.R") | def __init__(self, parent=None, signalManager=None, name="R Script"): OWWidget.__init__(self, parent, signalManager, name) self.inputs = [("in_data", ExampleTable, self.setData), ("in_distance", orange.SymMatrix, self.setDistance)] self.outputs = [("out_data", ExampleTable), ("out_distance", orange.SymMatrix), ("out_l... |
reportButton2 = OWGUI.button(graphGraphBox, self, "Report Graph", callback = self.reportGraph) | reportButton2 = OWGUI.button(graphGraphBox, self, "Report Graph", callback = self.reportGraph, debuggingEnabled=0) | def __init__(self, parent=None, signalManager=None, name="Interactive Discretization"): OWWidget.__init__(self, parent, signalManager, name) self.showBaseLine=1 self.showLookaheadLine=1 self.showTargetClassProb=1 self.showRug=0 self.snap=1 self.measure=0 self.targetClass=0 self.discretization = self.classDiscretization... |
self.inNetwork = None self.inExampleTable = None self.inDistanceMatrix = None | self.in_data = None self.in_network = None self.in_distance = None self.in_learner = None self.in_classifier = None | def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, 'Python Script') self.inputs = [("in_data", ExampleTable, self.setExampleTable), ("in_distance", orange.SymMatrix, self.setDistanceMatrix), ("in_network", orngNetwork.Network, self.setNetwork), ("in_learner", orange.Lea... |
OWGUI.label(self.infoBox, self, "<p>Execute python script.</p><p>Input variables:<ul><li> " + \ | label = OWGUI.label(self.infoBox, self, "<p>Execute python script.</p><p>Input variables:<ul><li> " + \ | def __init__(self, parent=None, signalManager=None): OWWidget.__init__(self, parent, signalManager, 'Python Script') self.inputs = [("in_data", ExampleTable, self.setExampleTable), ("in_distance", orange.SymMatrix, self.setDistanceMatrix), ("in_network", orngNetwork.Network, self.setNetwork), ("in_learner", orange.Lea... |
self.inExampleTable = et | self.in_data = et | def setExampleTable(self, et): self.inExampleTable = et |
self.inDistanceMatrix = dm | self.in_distance = dm | def setDistanceMatrix(self, dm): self.inDistanceMatrix = dm |
self.inNetwork = net | self.in_network = net | def setNetwork(self, net): self.inNetwork = net |
self.inLearner = learner | self.in_learner = learner | def setLearner(self, learner): self.inLearner = learner |
self.inClassifier = classifier | self.in_classifier = classifier | def setClassifier(self, classifier): self.inClassifier = classifier |
curve.symbol().setBrush(brush) curve.symbol().setPen(QPen(penColor)) | symbol = curve.symbol() symbol.setBrush(brush) symbol.setPen(QPen(penColor)) if QWT_VERSION_STR >= "5.2" and not curve.testItemAttribute(QwtPlotItem.Legend): curve.setSymbol(symbol) | def alphaChange(self): for curve in self.graph.itemList(): if isinstance(curve, QwtPlotCurve): brushColor = curve.symbol().brush().color() penColor = curve.symbol().pen().color() brushColor.setAlpha(self.graph.alphaValue) brush = QBrush(curve.symbol().brush()) brush.setColor(brushColor) penColor.setAlpha(self.graph.alp... |
curve.symbol().setSize(self.graph.pointWidth) | symbol = curve.symbol() symbol.setSize(self.graph.pointWidth) if QWT_VERSION_STR >= "5.2" and not curve.testItemAttribute(QwtPlotItem.Legend): curve.setSymbol(symbol) | def pointSizeChange(self): if self.attrSize: self.updateGraph() else: for curve in self.graph.itemList(): if isinstance(curve, QwtPlotCurve): curve.symbol().setSize(self.graph.pointWidth) self.graph.replot() |
def __init__(self, parent, master, callback, focusInCallback=None): | def __init__(self, parent, master, callback, focusInCallback=None, placeholder=False): | def __init__(self, parent, master, callback, focusInCallback=None): QLineEdit.__init__(self, parent) self.callback = callback self.focusInCallback = focusInCallback self.enterButton, self.placeHolder = enterButton(parent, self.sizeHint().height()) QObject.connect(self.enterButton, SIGNAL("clicked()"), self.returnPresse... |
self.enterButton, self.placeHolder = enterButton(parent, self.sizeHint().height()) | if placeholder: self.enterButton, self.placeHolder = enterButton(parent, self.sizeHint().height(), placeholder) else: self.enterButton = enterButton(parent, self.sizeHint().height(), placeholder) self.placeHolder = None | def __init__(self, parent, master, callback, focusInCallback=None): QLineEdit.__init__(self, parent) self.callback = callback self.focusInCallback = focusInCallback self.enterButton, self.placeHolder = enterButton(parent, self.sizeHint().height()) QObject.connect(self.enterButton, SIGNAL("clicked()"), self.returnPresse... |
self.placeHolder.hide() | if self.placeHolder: self.placeHolder.hide() | def markChanged(self, *e): self.placeHolder.hide() self.enterButton.show() |
self.placeHolder.show() | if self.placeHolder: self.placeHolder.show() | def markUnchanged(self, *e): self.enterButton.hide() self.placeHolder.show() |
callback=None, valueType = unicode, validator=None, controlWidth = None, callbackOnType = False, focusInCallback = None, **args): | callback=None, valueType = unicode, validator=None, controlWidth = None, callbackOnType = False, focusInCallback = None, enterPlaceholder=False, **args): | def lineEdit(widget, master, value, label=None, labelWidth=None, orientation='vertical', box=None, tooltip=None, callback=None, valueType = unicode, validator=None, controlWidth = None, callbackOnType = False, focusInCallback = None, **args): if box or label: b = widgetBox(widget, box, orientation) widgetLabel(b, label... |
wa = LineEditWFocusOut(bi, master, callback, focusInCallback) | wa = LineEditWFocusOut(bi, master, callback, focusInCallback, enterPlaceholder) | def lineEdit(widget, master, value, label=None, labelWidth=None, orientation='vertical', box=None, tooltip=None, callback=None, valueType = unicode, validator=None, controlWidth = None, callbackOnType = False, focusInCallback = None, **args): if box or label: b = widgetBox(widget, box, orientation) widgetLabel(b, label... |
minValue = float(min([x[colorIndex].value for x in table if x[colorIndex].value != "?"])) maxValue = float(max([x[colorIndex].value for x in table if x[colorIndex].value != "?"])) | minValue = float(min([x[colorIndex].value for x in table if x[colorIndex].value != "?"] or [0.0])) maxValue = float(max([x[colorIndex].value for x in table if x[colorIndex].value != "?"] or [0.0])) | def getColorIndeces(self, table, attribute, palette): colorIndices = {} colorIndex = None minValue = None maxValue = None if attribute[0] != "(" or attribute[ -1] != ")": i = 0 for var in table.domain.variables: if var.name == attribute: colorIndex = i if var.varType == orange.VarTypes.Discrete: colorIndices = getVari... |
clusterLeft.setSize(width, clusterHeight) | clusterLeft.setSize(height, clusterHeight) | def drawDistanceMap(self): """renders distance map object on canvas""" if not self.matrix: return self.clearScene() |
clusterTop.setPos(0, self.offsetY + clusterHeight) | clusterTop.setPos(0 + self.CellWidth / 2.0, self.offsetY + clusterHeight) | def drawDistanceMap(self): """renders distance map object on canvas""" if not self.matrix: return self.clearScene() |
clusterLeft.setPos(self.offsetX + clusterHeight, 0) | clusterLeft.setPos(self.offsetX + clusterHeight, 0 + self.CellHeight / 2.0) | def drawDistanceMap(self): """renders distance map object on canvas""" if not self.matrix: return self.clearScene() |
self.annotationText[i*2].setPos(self.offsetX + maxWidth + 3 + (i+0.5)*self.CellWidth, self.offsetY + maxWidth) | self.annotationText[i*2].setPos(self.offsetX + maxWidth + 3 + (i+0.5)*self.CellWidth + \ fontmetrics_row.height()/2.0, self.offsetY + maxWidth) | def drawDistanceMap(self): """renders distance map object on canvas""" if not self.matrix: return self.clearScene() |
self.annotationText[i*2 + 1].setPos(self.offsetX, self.offsetY + maxWidth + 3 + (i+0.5)*self.CellHeight) | self.annotationText[i*2 + 1].setPos(self.offsetX, self.offsetY + maxWidth + 3 + (i+0.5)*self.CellHeight +\ fontmetrics_col.height()/2.0) | def drawDistanceMap(self): """renders distance map object on canvas""" if not self.matrix: return self.clearScene() |
clusterTop.setPos(self.offsetX, clusterTop.y()) clusterLeft.setPos(clusterLeft.x(), self.offsetY) | clusterTop.setPos(self.offsetX + self.CellWidth/2.0/self.Merge, clusterTop.y()) clusterLeft.setPos(clusterLeft.x(), self.offsetY + self.CellHeight/2.0/self.Merge) | def drawDistanceMap(self): """renders distance map object on canvas""" if not self.matrix: return self.clearScene() |
dummy = QGraphicsSimpleTextItem("123", None, self.scene) for fontsize in range(8, 2, -1): font = QFont("", fontsize) dummy.setFont(font) if dummy.boundingRect().height() <= height: break self.scene.removeItem(dummy) return font | return QFont("", max(min(height, 8), 2)) | def getfont(self, height): """finds the font that for a given height""" dummy = QGraphicsSimpleTextItem("123", None, self.scene) for fontsize in range(8, 2, -1): font = QFont("", fontsize) dummy.setFont(font) if dummy.boundingRect().height() <= height: break self.scene.removeItem(dummy) return font |
if dinwin and (dinwin != win or not inside): | if dinwin and (dinwin != schema or not inside): | def mouseMoveEvent(self, e): if not self.mousePressed: # this is needed, otherwise another widget in the tree might get selected while we drag the icon to the canvas QTreeWidget.mouseMoveEvent(self, e) ### Semaphore "busy" is needed for some widgets whose loading takes more time, e.g. Select Data ### Since the active... |
if data and (len(data) == 0 or len(data.domain) == 0): | if data is not None and (len(data) == 0 or len(data.domain) == 0): | def setData(self, data, removeUnusedValues = 0): self.evaluatedAttributes = None self.aprioriDistribution = None self.aprioriProbabilities = None self.attributeNameIndex = {} self.attributeDistributions = {} self.logits = {} self.arguments = {} self.classVals = [] self.cvIndices = None self.contingencies = {} self.clea... |
if e.key() > 127: | if e.key() > 127 or e.key() < 0: | def keyPressEvent(self, e): self.ctrlPressed = int(e.modifiers()) & Qt.ControlModifier != 0 if e.key() > 127: #e.ignore() QWidget.keyPressEvent(self, e) return |
subDir = os.path.relpath(self.thisWidgetDir, self.widgetDir) return "doc/catalog/%s" % subDir | subDir = os.sep+os.path.relpath(self.thisWidgetDir, self.widgetDir) if os.path.relpath else self.thisWidgetDir.replace(self.widgetDir, "") return "doc/catalog%s" % subDir | def docDir(self): if os.path.normpath(self.widgetDir) in os.path.normpath(self.thisWidgetDir): # A built-in widget subDir = os.path.relpath(self.thisWidgetDir, self.widgetDir) return "doc/catalog/%s" % subDir elif os.path.normpath(self.addOnsDir) in os.path.normpath(self.thisWidgetDir): # An add-on widget # Two os.pa... |
subDir = os.path.relpath(os.path.split(self.thisWidgetDir)[0], self.addOnsDir) | addonDir = os.path.split(self.thisWidgetDir)[0] subDir = os.path.relpath(addonDir, self.addOnsDir) if os.path.relpath else addonDir.replace(self.addOnsDir, "") | def docDir(self): if os.path.normpath(self.widgetDir) in os.path.normpath(self.thisWidgetDir): # A built-in widget subDir = os.path.relpath(self.thisWidgetDir, self.widgetDir) return "doc/catalog/%s" % subDir elif os.path.normpath(self.addOnsDir) in os.path.normpath(self.thisWidgetDir): # An add-on widget # Two os.pa... |
self.classValuesModel.append(newlabel) | def addNewClassLabel(self): i = 1 while True: newlabel = "Class %i" %i if newlabel not in self.classValuesModel: self.classValuesModel.append(newlabel) break i += 1 | |
updateDefaultRepositories() | try: updateDefaultRepositories() except Exception, e: print "Unable to refresh default repositories: %s" % (e) | def loadRepositories(): listFileName = repositoryListFileName() global availableRepositories availableRepositories = [] if os.path.isfile(listFileName): try: import cPickle file = open(listFileName, 'rb') availableRepositories = [repo.clone() for repo in cPickle.load(file)] file.close() except Exception, e: print "Unab... |
def __init__(self, rules, examples, weightID = 0, **argkw): | def __init__(self, rules=None, examples=None, weightID = 0, **argkw): | def __init__(self, rules, examples, weightID = 0, **argkw): self.rules = rules self.examples = examples self.classVar = examples.domain.classVar self.__dict__.update(argkw) self.prior = orange.Distribution(examples.domain.classVar, examples) |
self.classVar = examples.domain.classVar | self.weightID = weightID self.classVar = None if examples is None else examples.domain.classVar | def __init__(self, rules, examples, weightID = 0, **argkw): self.rules = rules self.examples = examples self.classVar = examples.domain.classVar self.__dict__.update(argkw) self.prior = orange.Distribution(examples.domain.classVar, examples) |
self.prior = orange.Distribution(examples.domain.classVar, examples) | if examples is not None: self.prior = orange.Distribution(examples.domain.classVar, examples) | def __init__(self, rules, examples, weightID = 0, **argkw): self.rules = rules self.examples = examples self.classVar = examples.domain.classVar self.__dict__.update(argkw) self.prior = orange.Distribution(examples.domain.classVar, examples) |
self.classVar = examples.domain.classVar | self.classVar = examples.domain.classVar if examples is not None else None | def __init__(self, rules = None, examples = None, weightID = 0, **argkw): self.rules = rules self.examples = examples self.weightID = weightID self.classVar = examples.domain.classVar self.__dict__.update(argkw) if examples: self.prior = orange.Distribution(examples.domain.classVar, examples) |
if examples: | if examples is not None: | def __init__(self, rules = None, examples = None, weightID = 0, **argkw): self.rules = rules self.examples = examples self.weightID = weightID self.classVar = examples.domain.classVar self.__dict__.update(argkw) if examples: self.prior = orange.Distribution(examples.domain.classVar, examples) |
for c in self.examples.domain.classVar: retDist[c] /= sumdisc | if sumdisc > 0.0: for c in self.examples.domain.classVar: retDist[c] /= sumdisc else: retDist.normalize() | def add(disc1, disc2, sumd): disc = orange.DiscDistribution(disc1) sumdisc = sumd for i,d in enumerate(disc): disc[i]+=disc2[i] sumdisc += disc2[i] return disc, sumdisc |
retDist.normalize() | sumdist = sum(retDist) if sumdist > 0.0: for c in self.examples.domain.classVar: retDist[c] /= sumdisc else: retDist.normalize() | def __call__(self, example, result_type=orange.GetValue): retDist = orange.Distribution(example.domain.classVar) bestRule = None for r in self.rules: if r(example) and (not bestRule or r.quality>bestRule.quality): for v_i,v in enumerate(example.domain.classVar): retDist[v_i] = r.classDistribution[v_i] bestRule = r if n... |
for isplit in self.splitByIterations: if self.showIterations[i]: | for show, isplit in zip(self.showIterations, self.splitByIterations): if show: | def calcAverageCurves(self): ## ## self.averagingMethod == 'merge': mergedIterations = orngEval.ExperimentResults(1, self.splitByIterations[0].classifierNames, self.splitByIterations[0].classValues, self.splitByIterations[0].weights, classifiers=self.splitByIterations[0].classifiers, loaded=self.splitByIterations[0].lo... |
self.parent=parent self.callbackDeposit=[] | def __init__(self, parent=None, signalManager=None): #OWWidget.__init__(self, parent, 'Hierarchical Clustering') OWWidget.__init__(self, parent, signalManager, 'Hierarchical Clustering') self.parent=parent self.callbackDeposit=[] self.inputs=[("Distance matrix", orange.SymMatrix, self.dataset)] self.outputs=[("Selected... | |
ib = OWGUI.indentedBox(dendrogramBox, orientation = 0) OWGUI.widgetLabel(ib, "Depth"+ " ") slpd = OWGUI.hSlider(ib, self, "PrintDepth", minValue=1, maxValue=50, callback=self.applySettings) | option = QStyleOptionButton() cblp.initStyleOption(option) checkWidth = cblp.style().subElementRect(QStyle.SE_CheckBoxContents, option, cblp).x() ib = OWGUI.widgetBox(dendrogramBox, margin=0) ib.layout().setContentsMargins(checkWidth, 5, 5, 5) slpd = OWGUI.hSlider(ib, self, "PrintDepth", minValue=1, maxValue=50, lab... | def __init__(self, parent=None, signalManager=None): #OWWidget.__init__(self, parent, 'Hierarchical Clustering') OWWidget.__init__(self, parent, signalManager, 'Hierarchical Clustering') self.parent=parent self.callbackDeposit=[] self.inputs=[("Distance matrix", orange.SymMatrix, self.dataset)] self.outputs=[("Selected... |
callback=[lambda:self.hSizeBox.setDisabled(self.ManualHorSize), self.applySettings]) self.hSizeBox=OWGUI.spin(OWGUI.indentedBox(dendrogramBox), self, "HDSize", label="Size"+" ", min=200, | callback=self.applySettings) ib = OWGUI.widgetBox(dendrogramBox, margin=0) self.hSizeBox=OWGUI.spin(ib, self, "HDSize", label="Size"+" ", min=200, | def __init__(self, parent=None, signalManager=None): #OWWidget.__init__(self, parent, 'Hierarchical Clustering') OWWidget.__init__(self, parent, signalManager, 'Hierarchical Clustering') self.parent=parent self.callbackDeposit=[] self.inputs=[("Distance matrix", orange.SymMatrix, self.dataset)] self.outputs=[("Selected... |
cb = OWGUI.checkBox(box, self, "ClassifySelected", "Append cluster indices", callback=self.commitDataIf) self.classificationBox = ib = OWGUI.indentedBox(box) le = OWGUI.lineEdit(ib, self, "ClassifyName", "Name" + " ", callback=self.commitDataIf, orientation=0, controlWidth=75) OWGUI.separator(ib, height = 4) aa = OWGU... | cb = OWGUI.checkBox(box, self, "ClassifySelected", "Append cluster IDs", callback=self.commitDataIf) self.classificationBox = ib = OWGUI.widgetBox(box, margin=0) form = QWidget() le = OWGUI.lineEdit(form, self, "ClassifyName", None, callback=None, orientation="horizontal") self.connect(le, SIGNAL("editingFinished()")... | def __init__(self, parent=None, signalManager=None): #OWWidget.__init__(self, parent, 'Hierarchical Clustering') OWWidget.__init__(self, parent, signalManager, 'Hierarchical Clustering') self.parent=parent self.callbackDeposit=[] self.inputs=[("Distance matrix", orange.SymMatrix, self.dataset)] self.outputs=[("Selected... |
self.constructTree() | self.error(0) try: self.constructTree() except orange.KernelException, ex: self.error(0, "Could not cluster data! %s" % ex.message) self.dataset(None) | def dataset(self, data): self.matrix=data self.closeContext() if not self.matrix: self.rootCluster=None self.selectedExamples=None self.dendrogram.clear() self.footerView.clear() self.labelCombo.clear() self.send("Selected Examples", None) self.send("Unselected Examples", None) self.classificationBox.setDisabled(True) ... |
self.header.drawScale(self.treeAreaWidth, root.height) | def displayTree(self, root): self.clear() self.rootCluster=root if not self.rootCluster: return if not self.parent.ManualHorSize: width=self.parent.dendrogramView.size().width() else: width=self.parent.HDSize self.setSceneRect(0, 0, width, self.height()) self.textAreaWidth=100 | |
fix=max([a.boundingRect().width() for a in self.textObj]) self.setSceneRect(0, 0, leftMargin+self.treeAreaWidth+fix+rightMargin, 2*topMargin+self.gTextPos) | self.setSceneRect(self.itemsBoundingRect().adjusted(-5, -5, 5, 5)) | def displayTree(self, root): self.clear() self.rootCluster=root if not self.rootCluster: return if not self.parent.ManualHorSize: width=self.parent.dendrogramView.size().width() else: width=self.parent.HDSize self.setSceneRect(0, 0, width, self.height()) self.textAreaWidth=100 |
self.treeAreaWidth*cluster.height/self.treeHeight | self.treeAreaWidth*cluster.height/(self.treeHeight or 1) | def drawTree(self, cluster, l): level=l+1 if cluster.branches and (level<=self.parent.PrintDepth or \ not self.parent.PrintDepthCheck): (leftR, hi)=self.drawTree(cluster.left, level) (rightR,low)=self.drawTree(cluster.right, level) top=leftMargin+self.treeAreaWidth- \ self.treeAreaWidth*cluster.height/self.treeHeight r... |
self.setSceneRect(0, 0, leftMargin+self.treeAreaWidth+max([a.boundingRect().width() \ for a in self.textObj])+rightMargin, self.height()) | self.setSceneRect(self.itemsBoundingRect().adjusted(-5, -5, 5, 5)) | def updateLabel(self): if not self.rootCluster: return for a in self.textObj: if len(a.cluster)>1 and not self.parent.Annotation==0: a.setPlainText("(%i items)" % len(a.cluster)) else: a.setPlainText(str(a.cluster[0])) self.setSceneRect(0, 0, leftMargin+self.treeAreaWidth+max([a.boundingRect().width() \ for a in self.t... |
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) | self.setAlignment(Qt.AlignLeft | Qt.AlignTop) | def __init__(self, parent, *args): apply(QGraphicsView.__init__, (self,)+args) self.parent=parent self.setFixedHeight(20) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.scene().obj=[] self.scene().marker=QGraphicsRectItem(None, self.scene()) self.sce... |
self.scene().clear() self.scene().obj=[] | for a in self.scene().obj: self.scene().removeItem(a) if self.scene().marker.scene() is self.scene(): self.scene().removeItem(self.scene().marker) self.scene().obj = [] | def clear(self): self.scene().clear() |
xPos-=(distInc/height)*treeAreaW | xPos-=(distInc/(height or 1))*treeAreaW | def drawScale(self, treeAreaW, height): self.clear() self.scene().treeAreaW=treeAreaW self.scene().treeHeight=height xPos=leftMargin+treeAreaW dist=0 distInc=math.floor(height/5)/2 if distInc==0: distInc=0.25 while xPos>=leftMargin: text=OWCanvasText(self.scene(), str(dist), xPos, 9, Qt.AlignCenter) text.setZValue(0) l... |
self.marker=OWCanvasRectangle(self.scene(),self.markerPos-3,0,1,20, brushColor=QColor("blue")) | self.marker=OWCanvasRectangle(self.scene(),self.markerPos - 1,0,1,20, brushColor=QColor("blue")) | def drawScale(self, treeAreaW, height): self.clear() self.scene().treeAreaW=treeAreaW self.scene().treeHeight=height xPos=leftMargin+treeAreaW dist=0 distInc=math.floor(height/5)/2 if distInc==0: distInc=0.25 while xPos>=leftMargin: text=OWCanvasText(self.scene(), str(dist), xPos, 9, Qt.AlignCenter) text.setZValue(0) l... |
self.scene().obj.append(self.marker) | def drawScale(self, treeAreaW, height): self.clear() self.scene().treeAreaW=treeAreaW self.scene().treeHeight=height xPos=leftMargin+treeAreaW dist=0 distInc=math.floor(height/5)/2 if distInc==0: distInc=0.25 while xPos>=leftMargin: text=OWCanvasText(self.scene(), str(dist), xPos, 9, Qt.AlignCenter) text.setZValue(0) l... | |
if e.pos().x()<0 and e.pos().x()>leftMargin+self.scene().treeAreaW: return | pos = self.mapToScene(e.pos()) if pos.x()<0 and pos.x()>leftMargin+self.scene().treeAreaW: pos = QPointF(max(min(pos.x(), leftMargin+self.scene().treeAreaW), 0), pos.y()) | def mousePressEvent(self, e): if e.pos().x()<0 and e.pos().x()>leftMargin+self.scene().treeAreaW: return self.commitStatus=self.parent.CommitOnChange self.parent.CommitOnChange=False self.marker=self.scene().marker self.markerPos=e.pos().x()+3 self.marker.setPos(self.markerPos-3,0) self.markerDragged=True self.parent.d... |
self.markerPos=e.pos().x()+3 self.marker.setPos(self.markerPos-3,0) | self.markerPos=pos.x() self.marker.setPos(self.markerPos, 0) | def mousePressEvent(self, e): if e.pos().x()<0 and e.pos().x()>leftMargin+self.scene().treeAreaW: return self.commitStatus=self.parent.CommitOnChange self.parent.CommitOnChange=False self.marker=self.scene().marker self.markerPos=e.pos().x()+3 self.marker.setPos(self.markerPos-3,0) self.markerDragged=True self.parent.d... |
self.parent.dendrogram.setCutOffLine(e.pos().x()) | self.parent.dendrogram.setCutOffLine(pos.x()) | def mousePressEvent(self, e): if e.pos().x()<0 and e.pos().x()>leftMargin+self.scene().treeAreaW: return self.commitStatus=self.parent.CommitOnChange self.parent.CommitOnChange=False self.marker=self.scene().marker self.markerPos=e.pos().x()+3 self.marker.setPos(self.markerPos-3,0) self.markerDragged=True self.parent.d... |
self.parent.dendrogram.setCutOffLine(e.pos().x()) | self.parent.dendrogram.setCutOffLine(pos.x()) | def mouseReleaseEvent(self, e): self.markerDragged=False self.parent.CommitOnChange=self.commitStatus self.parent.dendrogram.setCutOffLine(e.pos().x()) |
if e.pos().x()<0 or e.pos().x()>leftMargin+self.scene().treeAreaW: return if self.markerDragged and e.pos(): self.markerPos=e.pos().x()+3 self.marker.setPos(self.markerPos-3,0) self.parent.dendrogram.setCutOffLine(e.pos().x()) | pos = self.mapToScene(e.pos()) if pos.x()<0 or pos.x()>leftMargin+self.scene().treeAreaW: pos = QPointF(max(min(pos.x(), leftMargin+self.scene().treeAreaW), 0), pos.y()) if self.markerDragged and pos: self.markerPos=pos.x() self.marker.setPos(self.markerPos,0) self.parent.dendrogram.setCutOffLine(pos.x()) | def mouseMoveEvent(self, e): if e.pos().x()<0 or e.pos().x()>leftMargin+self.scene().treeAreaW: return if self.markerDragged and e.pos(): self.markerPos=e.pos().x()+3 self.marker.setPos(self.markerPos-3,0) self.parent.dendrogram.setCutOffLine(e.pos().x()) |
self.unselectedExamples = orange.ExampleTable(unselected) | self.unselectedExamples = orange.ExampleTable(unselected) if unselected else None | def commitData(self): self.settingsChanged = False self.selection=[] selection=self.selectionList maps=[self.rootCluster.mapping[c.first:c.last] for c in [e.rootCluster for e in selection]] self.selection=[self.matrix.items[k] for k in [j for i in range(len(maps)) for j in maps[i]]] if not self.selection: self.send("S... |
updateWeights(w, attr, float(SVs[svInd][attr]), classifier.coef[coefInd][svInd]) | updateWeights(w, attr, to_float(SVs[svInd][attr]), classifier.coef[coefInd][svInd]) | def updateWeights(w, key, val, mul): if key in w: w[key]+=mul*val else: w[key]=mul*val |
self.learner = learner or SVMLearner(kernel_type=orange.SVMLearner.Linear) | self.learner = learner or SVMLearner(kernel_type=orange.SVMLearner.Linear, normalization=False) | def __init__(self, learner=None): self.learner = learner or SVMLearner(kernel_type=orange.SVMLearner.Linear) |
attrs = data.domain.attributese | attrs = data.domain.attributes | def getAttrScores(self, data, stopAt=0): """ Return a dict mapping attributes to scores (scores are not scores in a general meaning they represent the step number at which they were removed from the recursive evaluation). """ iter = 1 attrs = data.domain.attributese attrScores = {} while len(attrs)>stopAt: weights = ge... |
min=1, max=100, callback=self.update, callbackOnReturn=True) | min=1, max=100 if not orngDebugging.orngDebuggingEnabled else 5, callback=self.update, callbackOnReturn=True) | def __init__(self, parent=None, signalManager = None): OWWidget.__init__(self, parent, signalManager, 'k-Means Clustering') |
table1.extend(orange.ExampleTable(self.selection)) | table1.extend(orange.ExampleTable(self.selection) if self.selection else []) | def commitData(self): self.settingsChanged = False self.selection=[] selection=self.selectionList maps=[self.rootCluster.mapping[c.first:c.last] for c in [e.rootCluster for e in selection]] self.selection=[self.matrix.items[k] for k in [j for i in range(len(maps)) for j in maps[i]]] if not self.selection: self.send("S... |
table2.extend(orange.ExampleTable(unselected)) | table2.extend(orange.ExampleTable(unselected) if unselected else []) | def commitData(self): self.settingsChanged = False self.selection=[] selection=self.selectionList maps=[self.rootCluster.mapping[c.first:c.last] for c in [e.rootCluster for e in selection]] self.selection=[self.matrix.items[k] for k in [j for i in range(len(maps)) for j in maps[i]]] if not self.selection: self.send("S... |
data = pyqtProperty(Preprocessor_discretize, | data = _pyqtProperty(Preprocessor_discretize, | def setDiscretizer(self, discretizer): disc = dict([(val, i) for i, (_, val, _) in enumerate(self.DISCRETIZERS)]) self.discInd = disc.get(_gettype(discretizer.method), 3) _, d, kwargs = self.DISCRETIZERS[self.discInd] for key, val in kwargs.items(): setattr(self, key, getattr(discretizer.method, key, val)) self.update... |
data = pyqtProperty(Preprocessor_continuize, | data = _pyqtProperty(Preprocessor_continuize, | def setContinuizer(self, continuizer): if isinstance(continuizer, Preprocessor_removeDiscrete): self.contInd = 3 #Ignore all discrete elif isinstance(continuizer,Preprocessor_continuize): self.contInd = self.TREATMENT_TO_IND.get(continuizer.multinomialTreatment, 3) |
data = pyqtProperty(Preprocessor_imputeByLearner, | data = _pyqtProperty(Preprocessor_imputeByLearner, | def setImputer(self, imputer): self.methodInd = 0 if isinstance(imputer, Preprocessor_imputeByLearner): learner = imputer.learner dd = dict([(t, i) for i, (_, t) in enumerate(self.IMPUTERS)]) self.methodInd = dd.get(_gettype(learner), 0) elif isinstance(imputer, orange.Preprocessor_dropMissing): self.methodInd = 3 |
data = pyqtProperty(Preprocessor_featureSelection, | data = _pyqtProperty(Preprocessor_featureSelection, | def getFeatureSelection(self): return Preprocessor_featureSelection(measure=self.MEASURES[self.measureInd][1], filter=self.FILTERS[self.selectBy], limit=self.bestP if self.selectBy else self.bestN) |
data = pyqtProperty(Preprocessor_sample, | data = _pyqtProperty(Preprocessor_sample, | def setSampler(self, sampler): filter = dict([(s, i) for i, s in enumerate(self.FILTERS)]) self.methodInd = filter.get(sampler.filter, 0) if self.methodInd == 0: self.sampleN = sampler.limit else: self.sampleP = sampler.limit self.updateSpinStates() |
if i == -1 and self.attrList.selectedItems() != []: i = self.attrList.row(self.attrList.selectedItems()[0]) | if i == -1: if self.attrList.selectedItems() != []: i = self.attrList.row(self.attrList.selectedItems()[0]) else: i = 0 | def individualSelected(self, i = -1): if i == -1 and self.attrList.selectedItems() != []: i = self.attrList.row(self.attrList.selectedItems()[0]) if self.data: self.selectedAttr = i attr = self.data.domain[i] attrName = attr.name self.indiType = self.methods.get(attrName, (0, ""))[0] else: attr = None |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.