Ejemplo n.º 1
0
 def buildMidLabels(self, attrs):
     labels = []
     if self.middleLabels == "No labels" or not self.graph.haveData:
         return None
     elif self.middleLabels == "Correlations":
         for i in range(len(attrs) - 1):
             corr = None
             if self.correlationDict.has_key((attrs[i], attrs[i + 1])):
                 corr = self.correlationDict[(attrs[i], attrs[i + 1])]
             elif self.correlationDict.has_key((attrs[i + 1], attrs[i])):
                 corr = self.correlationDict[(attrs[i + 1], attrs[i])]
             else:
                 try:
                     corr = orngVisFuncts.computeCorrelation(
                         self.graph.rawData, attrs[i], attrs[i + 1])
                 except:
                     corr = None
                 self.correlationDict[(attrs[i], attrs[i + 1])] = corr
             if corr and (self.graph.attributeFlipInfo.get(attrs[i], 0)
                          != self.graph.attributeFlipInfo.get(
                              attrs[i + 1], 0)):
                 corr = -corr
             if corr: labels.append("%2.3f" % (corr))
             else: labels.append("")
     elif self.middleLabels == "VizRank":
         for i in range(len(attrs) - 1):
             val = self.optimizationDlg.getVizRankVal(
                 attrs[i], attrs[i + 1])
             if val: labels.append("%2.2f%%" % (val))
             else: labels.append("")
     return labels
Ejemplo n.º 2
0
 def buildMidLabels(self, attrs):
     labels = []
     if self.middleLabels == "No labels" or not self.graph.haveData: return None
     elif self.middleLabels == "Correlations":
         for i in range(len(attrs)-1):
             corr = None
             if self.correlationDict.has_key((attrs[i], attrs[i+1])):   corr = self.correlationDict[(attrs[i], attrs[i+1])]
             elif self.correlationDict.has_key((attrs[i+1], attrs[i])): corr = self.correlationDict[(attrs[i+1], attrs[i])]
             else:
                 try:
                     corr = orngVisFuncts.computeCorrelation(self.graph.rawData, attrs[i], attrs[i+1])
                 except:
                     corr = None
                 self.correlationDict[(attrs[i], attrs[i+1])] = corr
             if corr and (self.graph.attributeFlipInfo.get(attrs[i], 0) != self.graph.attributeFlipInfo.get(attrs[i+1], 0)): corr = -corr
             if corr: labels.append("%2.3f" % (corr))
             else: labels.append("")
     elif self.middleLabels == "VizRank":
         for i in range(len(attrs)-1):
             val = self.optimizationDlg.getVizRankVal(attrs[i], attrs[i+1])
             if val: labels.append("%2.2f%%" % (val))
             else: labels.append("")
     return labels