Changeset 3699:547d8c6d04f6 in orange


Ignore:
Timestamp:
05/27/07 18:51:59 (7 years ago)
Author:
Gregor <Gregor@…>
Branch:
default
Convert:
b2ab204c1baa35d41b4fc4019453c0ec80fa5277
Message:

useSupervisedPCA -> projOptimizationMethod (because PLS was added)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/orngVizRank.py

    r3537 r3699  
    120120        self.attrDisc = DISC_MEAS_RELIEFF 
    121121        self.attrSubsetSelection = GAMMA_ALL                # how do we find attribute subsets to evaluate - deterministic according to attribute ranking score or using gamma distribution - if using gamma, do we want to evaluate all possible permutations of attributes or only one 
    122         self.useSupervisedPCA = 0                           # use the supervisedPCA 
     122        self.projOptimizationMethod = 0                     # None, supervisedPCA, partial least square 
    123123        self.useExampleWeighting = 0                        # weight examples, so that the class that has a low number of examples will have higher weights 
    124124 
     
    601601                for i in range(minLength, maxLength+1): 
    602602                    if i > len(attributes): continue        # if we don't have enough attributes 
    603                     if self.useSupervisedPCA: 
     603                    if self.projOptimizationMethod != 0: 
    604604                        permutationIndices[i] = [range(i)] 
    605605                    else: 
     
    704704 
    705705            # create only one permutation, because its all we need 
    706             elif self.useSupervisedPCA: 
     706            elif self.projOptimizationMethod != 0: 
    707707                permutations.append(reduce(operator.add, combination)) 
    708708            else: 
     
    729729        return permutations 
    730730 
     731 
    731732    # ########################################################################## 
    732733    # MAIN FUNCTION FOR EVALUATING PROJECTIONS 
     
    784785        # #################### RADVIZ, LINEAR_PROJECTION  ################################ 
    785786        elif self.visualizationMethod in (RADVIZ, LINEAR_PROJECTION, POLYVIZ): 
    786             if self.useSupervisedPCA: 
     787            if self.projOptimizationMethod != 0: 
    787788                self.freeviz.useGeneralizedEigenvectors = 1 
    788789                self.graph.normalizeExamples = 0 
     
    810811                    attrIndices = permutations[0] 
    811812 
    812                     if self.useSupervisedPCA: 
    813                         xanchors, yanchors, (attrNames, newIndices) = self.freeviz.findSPCAProjection(attrIndices, setGraphAnchors = 0, percentDataUsed = self.percentDataUsed) 
     813                    if self.projOptimizationMethod != 0: 
     814                        xanchors, yanchors, (attrNames, newIndices) = self.freeviz.findProjection(self.projOptimizationMethod, attrIndices, setAnchors = 0, percentDataUsed = self.percentDataUsed) 
    814815                        table = self.graph.createProjectionAsExampleTable(newIndices, domain = domain, XAnchors = xanchors, YAnchors = yanchors) 
    815816                        if len(table) < self.minNumOfExamples: continue 
     
    958959 
    959960                # first try to use the attributes in the projection and evaluate only different permutations of these attributes 
    960                 if self.locOptOptimizeProjectionByPermutingAttributes == 1 and self.useSupervisedPCA == 0: 
     961                if self.locOptOptimizeProjectionByPermutingAttributes == 1 and self.projOptimizationMethod == 0: 
    961962                    bestProjection = projection; tempProjection = projection 
    962963                    bestAccuracy = accuracy; tempAccuracy = accuracy 
     
    10101011                        tempList = [] 
    10111012 
    1012                         # supervised PCA 
    1013                         if self.useSupervisedPCA: 
     1013                        # SPCA, PLS 
     1014                        if self.projOptimizationMethod != 0: 
    10141015                            if iteration == 0:  # replace one attribute in each projection with attribute attr 
    10151016                                testProjections = [copy(projection) for i in range(len(projection))] 
     
    10211022                                if newProjDict.has_key(str(proj)): continue 
    10221023                                newProjDict[str(proj)] = 1 
    1023                                 xanchors, yanchors, (attrNames, newIndices) = self.freeviz.findSPCAProjection(proj, setGraphAnchors = 0) 
     1024                                xanchors, yanchors, (attrNames, newIndices) = self.freeviz.findProjection(self.projOptimizationMethod, attrIndices, setAnchors = 0, percentDataUsed = self.percentDataUsed) 
    10241025                                table = self.graph.createProjectionAsExampleTable(newIndices, domain = domain, XAnchors = xanchors, YAnchors = yanchors) 
    10251026                                if len(table) < self.minNumOfExamples: continue 
     
    10981099        file = open(name, "wt") 
    10991100 
    1100         attrs = ["kValue", "percentDataUsed", "qualityMeasure", "testingMethod", "parentName", "evaluationAlgorithm", "useExampleWeighting", "useSupervisedPCA", "attrSubsetSelection", "optimizationType", "attributeCount", "attrDisc", "attrCont", "timeLimit", "projectionLimit"] 
     1101        attrs = ["kValue", "percentDataUsed", "qualityMeasure", "testingMethod", "parentName", "evaluationAlgorithm", "useExampleWeighting", "projOptimizationMethod", "attrSubsetSelection", "optimizationType", "attributeCount", "attrDisc", "attrCont", "timeLimit", "projectionLimit"] 
    11011102        dict = {} 
    11021103        for attr in attrs: dict[attr] = self.__dict__.get(attr) 
     
    12651266    vizrank.attributeCount = 10 
    12661267    vizrank.attrCont = CONT_MEAS_S2NMIX 
    1267     vizrank.useSupervisedPCA = 0 
     1268    vizrank.projOptimizationMethod = 0 
    12681269    vizrank.useExampleWeighting = 0 
    12691270    vizrank.attrSubsetSelection = GAMMA_SINGLE 
Note: See TracChangeset for help on using the changeset viewer.