Changeset 3649:0aed7afd6d34 in orange


Ignore:
Timestamp:
05/12/07 15:16:03 (7 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
325179efe3491c9c78a6a2459c5e543fc3ba17fd
Message:
  • fixed a problem with unknown values in freeviz (they were changed into some odd huge numbers, so optimization didn't work)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/orngLinProj.py

    r3536 r3649  
    124124 
    125125    def optimize_FAST_Separation(self, steps = 10, singleStep = False): 
    126         classes = [int(x.getclass()) for x in self.graph.rawdata] 
    127126        optimizer = [orangeom.optimizeAnchors, orangeom.optimizeAnchorsRadial, orangeom.optimizeAnchorsR][self.restrain] 
    128127        ai = self.graph.attributeNameIndex 
     
    133132        positions = [numpy.array([x[:2] for x in self.graph.anchorData])] 
    134133        neededSteps = 0 
     134 
     135        validData = self.graph.getValidList(attrIndices) 
     136        if sum(validData) == 0: 
     137            return 0 
     138 
     139        data = numpy.compress(validData, self.graph.noJitteringScaledData, axis=1) 
     140        data = numpy.transpose(data).tolist() 
     141        classes = [int(x.getclass()) for i,x in enumerate(self.graph.rawdata) if validData[i]] 
     142         
    135143        while 1: 
    136             self.graph.anchorData = optimizer(numpy.transpose(self.graph.scaledData).tolist(), classes, self.graph.anchorData, attrIndices, 
     144            self.graph.anchorData = optimizer(data, classes, self.graph.anchorData, attrIndices, 
    137145                                              attractG = self.attractG, repelG = self.repelG, law = self.law, 
    138146                                              sigma2 = self.forceSigma, dynamicBalancing = self.forceBalancing, steps = steps, 
     
    149157            positions = positions[-49:]+[numpy.array([x[:2] for x in self.graph.anchorData])] 
    150158            if len(positions)==50: 
    151                 m = max(numpy.sum((positions[0]-positions[49])**2, 1)) 
     159                m = max(numpy.sum((positions[0]-positions[49])**2), 0) 
    152160                if m < 1e-3: break 
    153161            if singleStep or (self.__class__ != FreeViz and self.cancelOptimization): 
Note: See TracChangeset for help on using the changeset viewer.