Changeset 3651:068cde0d4785 in orange


Ignore:
Timestamp:
05/12/07 15:39:24 (7 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
3be216b455a7f6f37fac88883665512f12a766fc
Message:
  • FreeViz.optimizeSeparation only called optimization for discrete classes, although the "fast implementation" works with the continuous, too. fixed.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/orngLinProj.py

    r3649 r3651  
    101101    def optimizeSeparation(self, steps = 10, singleStep = False): 
    102102        # check if we have data and a discrete class 
    103         if not self.rawdata or len(self.rawdata) == 0 or not self.rawdata.domain.classVar or self.rawdata.domain.classVar.varType != orange.VarTypes.Discrete: 
     103        if not self.rawdata or len(self.rawdata) == 0 or not self.rawdata.domain.classVar: 
    104104            return 
     105 
    105106        if self.implementation == FAST_IMPLEMENTATION: 
    106107            return self.optimize_FAST_Separation(steps, singleStep) 
    107         else: 
    108             if singleStep: steps = 1 
    109             if self.implementation == SLOW_IMPLEMENTATION:  impl = self.optimize_SLOW_Separation 
    110             elif self.implementation == LDA_IMPLEMENTATION: impl = self.optimize_LDA_Separation 
    111             ai = self.graph.attributeNameIndex 
    112             attrIndices = [ai[label] for label in self.getShownAttributeList()] 
    113             XAnchors = None; YAnchors = None 
    114             if self.__class__ != FreeViz: from qt import qApp 
    115  
    116             for c in range((singleStep and 1) or 50): 
    117                 for i in range(steps): 
    118                     if self.__class__ != FreeViz and self.cancelOptimization == 1: return 
    119                     self.graph.anchorData, (XAnchors, YAnchors) = impl(attrIndices, self.graph.anchorData, XAnchors, YAnchors) 
    120                 if self.graph.__class__ != orngScaleLinProjData: 
    121                     qApp.processEvents() 
    122                     self.graph.updateData() 
    123                 #self.recomputeEnergy() 
     108 
     109        if self.rawdata.domain.classVar.varType != orange.VarTypes.Discrete: 
     110            return 
     111 
     112        if singleStep: steps = 1 
     113        if self.implementation == SLOW_IMPLEMENTATION:  impl = self.optimize_SLOW_Separation 
     114        elif self.implementation == LDA_IMPLEMENTATION: impl = self.optimize_LDA_Separation 
     115        ai = self.graph.attributeNameIndex 
     116        attrIndices = [ai[label] for label in self.getShownAttributeList()] 
     117        XAnchors = None; YAnchors = None 
     118        if self.__class__ != FreeViz: from qt import qApp 
     119 
     120        for c in range((singleStep and 1) or 50): 
     121            for i in range(steps): 
     122                if self.__class__ != FreeViz and self.cancelOptimization == 1: return 
     123                self.graph.anchorData, (XAnchors, YAnchors) = impl(attrIndices, self.graph.anchorData, XAnchors, YAnchors) 
     124            if self.graph.__class__ != orngScaleLinProjData: 
     125                qApp.processEvents() 
     126                self.graph.updateData() 
     127            #self.recomputeEnergy() 
    124128 
    125129    def optimize_FAST_Separation(self, steps = 10, singleStep = False): 
Note: See TracChangeset for help on using the changeset viewer.