Changeset 7660:5f432be7cddc in orange


Ignore:
Timestamp:
02/12/11 23:19:04 (3 years ago)
Author:
janezd <janez.demsar@…>
Branch:
default
Convert:
065072cddb261207a690cebf4038c8cf7a8ecf9d
Message:

Renamed Orange.data.feature to Orange.data.variable

Location:
orange
Files:
2 added
2 deleted
15 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/__init__.py

    r7659 r7660  
    1111import data.io 
    1212import data.sample 
    13 import data.feature 
     13import data.variable 
    1414 
    1515import network 
  • orange/Orange/classification/lookup.py

    r7575 r7660  
    329329    a, b, e = table.domain["a"], table.domain["b"], table.domain["e"] 
    330330 
    331     y2 = Orange.data.feature.Discrete("y2", values = ["0", "1"]) 
     331    y2 = Orange.data.variable.Discrete("y2", values = ["0", "1"]) 
    332332    abe2 = Orange.classification.lookup.LookupLearner(y2, [a, b, e], table) 
    333333 
     
    429429         
    430430def printLookupFunction(func): 
    431     if isinstance(func, Orange.data.feature.Feature): 
     431    if isinstance(func, Orange.data.variable.Variable): 
    432432        if not func.getValueFrom: 
    433433            raise TypeError, "attribute '%s' does not have an associated function" % func.name 
  • orange/Orange/classification/rules.py

    r7603 r7660  
    11001100            weights = Orange.core.newmetaid() 
    11011101            instances.addMetaAttribute(weights,1.) 
    1102             instances.domain.addmeta(weights, Orange.data.feature.\ 
     1102            instances.domain.addmeta(weights, Orange.data.variable.\ 
    11031103                Continuous("weights-"+str(weights)), True) 
    11041104        newWeightsID = Orange.core.newmetaid() 
    11051105        instances.addMetaAttribute(newWeightsID,1.) 
    1106         instances.domain.addmeta(newWeightsID, Orange.data.feature.\ 
     1106        instances.domain.addmeta(newWeightsID, Orange.data.variable.\ 
    11071107            Continuous("weights-"+str(newWeightsID)), True) 
    11081108        for instance in instances: 
     
    11251125            weights = Orange.core.newmetaid() 
    11261126            instances.addMetaAttribute(weights,1.) 
    1127             instances.domain.addmeta(weights, Orange.data.feature.\ 
     1127            instances.domain.addmeta(weights, Orange.data.variable.\ 
    11281128                Continuous("weights-"+str(weights)), True) 
    11291129        try: 
    11301130            coverage = instances.domain.getmeta("Coverage") 
    11311131        except: 
    1132             coverage = Orange.data.feature.Continuous("Coverage") 
     1132            coverage = Orange.data.variable.Continuous("Coverage") 
    11331133            instances.domain.addmeta(Orange.core.newmetaid(),coverage, True) 
    11341134            instances.addMetaAttribute(coverage,0.0) 
    11351135        newWeightsID = Orange.core.newmetaid() 
    11361136        instances.addMetaAttribute(newWeightsID,1.) 
    1137         instances.domain.addmeta(newWeightsID, Orange.data.feature.\ 
     1137        instances.domain.addmeta(newWeightsID, Orange.data.variable.\ 
    11381138            Continuous("weights-"+str(newWeightsID)), True) 
    11391139        for instance in instances: 
     
    11621162        instances.addMetaAttribute(self.probAttribute,-1.e-6) 
    11631163        instances.domain.addmeta(self.probAttribute, \ 
    1164             Orange.data.feature.Continuous("Probs")) 
     1164            Orange.data.variable.Continuous("Probs")) 
    11651165        for instance in instances: 
    11661166##            if targetClass<0 or (instance.getclass() == targetClass): 
  • orange/Orange/classification/svm/__init__.py

    r7625 r7660  
    515515            for svInd in apply(range, svRanges[i]): 
    516516                attributes = SVs.domain.attributes + \ 
    517                 SVs[svInd].getmetas(False, Orange.data.feature.Feature).keys() 
     517                SVs[svInd].getmetas(False, Orange.data.variable.Variable).keys() 
    518518                for attr in attributes: 
    519519                    if attr.varType==Orange.data.Type.Continuous: 
     
    523523            for svInd in apply(range, svRanges[j]): 
    524524                attributes = SVs.domain.attributes + \ 
    525                 SVs[svInd].getmetas(False, Orange.data.feature.Feature).keys() 
     525                SVs[svInd].getmetas(False, Orange.data.variable.Variable).keys() 
    526526                for attr in attributes: 
    527527                    if attr.varType==Orange.data.Type.Continuous: 
  • orange/Orange/classification/tree.py

    r7639 r7660  
    630630    The constructed :obj:`branchSelector` is an instance of  
    631631    :obj:`orange.ClassifierFromVarFD` that returns a value of the  
    632     selected attribute. If the attribute is :obj:`Orange.data.feature.Discrete`, 
     632    selected attribute. If the attribute is :obj:`Orange.data.variable.Discrete`, 
    633633    :obj:`branchDescription`'s are the attribute's values. The  
    634634    attribute is marked as spent, so that it cannot reappear in the  
     
    18191819:attr:`TreeClassifier.nodeClassifier` in a leaf returns.  
    18201820As :samp:`%V` uses the  
    1821 :obj:`Orange.data.feature.Continuous`'s function for printing out the value,  
     1821:obj:`Orange.data.variable.Continuous`' function for printing out the value,  
    18221822therefore the printed number has the same number of decimals  
    18231823as in the data file. 
  • orange/Orange/ensemble/bagging.py

    r7560 r7660  
    8585     
    8686    :param classVar: the class feature. 
    87     :type classVar: :class:`Orange.data.feature.Feature` 
     87    :type classVar: :class:`Orange.data.variable.Variable` 
    8888 
    8989    """ 
  • orange/Orange/ensemble/boosting.py

    r7560 r7660  
    109109     
    110110    :param classVar: the class feature. 
    111     :type classVar: :class:`Orange.data.feature.Feature` 
     111    :type classVar: :class:`Orange.data.variable.Variable` 
    112112     
    113113    """ 
  • orange/Orange/ensemble/forest.py

    r7560 r7660  
    133133     
    134134    :param classVar: the class feature. 
    135     :type classVar: :class:`Orange.data.feature.Feature` 
     135    :type classVar: :class:`Orange.data.variable.Variable` 
    136136 
    137137    """ 
     
    229229         
    230230        :param feature: feature to evaluate (by index, name or 
    231             :class:`Orange.data.feature.Feature` object). 
    232         :type feature: int, str or :class:`Orange.data.feature.Feature`. 
     231            :class:`Orange.data.variable.Variable` object). 
     232        :type feature: int, str or :class:`Orange.data.variable.Variable`. 
    233233         
    234234        :param instances: data instances to use for importance evaluation. 
     
    245245          attrName = feature 
    246246          attrNo = instances.domain.index(attrName) 
    247         elif isinstance(feature, Orange.data.feature.Feature): 
     247        elif isinstance(feature, Orange.data.variable.Variable): 
    248248          atrs = [a for a in instances.domain.attributes] 
    249249          attrNo = atrs.index(feature) 
  • orange/Orange/feature/discretization.py

    r7646 r7660  
    1818     
    1919    :param attribute: continuous feature to discretize 
    20     :type attribute: :obj:`Orange.data.feature.Feature` 
     20    :type attribute: :obj:`Orange.data.variable.Variable` 
    2121    :param examples: data to discretize 
    2222    :type examples: :obj:`Orange.data.Table` 
    2323    :param weight: meta feature that stores weights of individual data 
    2424          instances 
    25     :type weight: Orange.data.feature.Feature 
    26     :rtype: :obj:`Orange.data.feature.Discrete` 
     25    :type weight: Orange.data.variable.Variable 
     26    :rtype: :obj:`Orange.data.variable.Discrete` 
    2727         
    2828.. automethod:: Orange.feature.discretization.entropyDiscretization_wrapper 
  • orange/Orange/feature/scoring.py

    r7659 r7660  
    501501        :param weight: meta feature that stores weights of individual data 
    502502          instances 
    503         :type weight: Orange.data.Feature 
     503        :type weight: Orange.data.variable 
    504504 
    505505        """ 
     
    518518     
    519519    :param attr: feature to score 
    520     :type attr: Orange.data.feature 
     520    :type attr: Orange.data.variable 
    521521     
    522522    :param data: data table used for feature scoring 
     
    534534    def __call__(self, attr, data, aprioriDist = None, weightID = None): 
    535535        """Take :obj:`Orange.data.table` data table and score the given  
    536         :obj:`Orange.data.feature`. 
     536        :obj:`Orange.data.variable`. 
    537537 
    538538        :param attr: feature to score 
    539         :type attr: Orange.data.feature 
     539        :type attr: Orange.data.variable 
    540540 
    541541        :param data: a data table used to score features 
     
    546546         
    547547        :param weightID: meta feature used to weight individual data instances 
    548         :type weightID: Orange.data.feature 
     548        :type weightID: Orange.data.variable 
    549549 
    550550        """ 
     
    577577    def __call__(self, attr, data, aprioriDist = None, weightID = None): 
    578578        """Take :obj:`Orange.data.table` data table and score the given  
    579         :obj:`Orange.data.feature`. 
     579        :obj:`Orange.data.variable`. 
    580580 
    581581        :param attr: feature to score 
    582         :type attr: Orange.data.feature 
     582        :type attr: Orange.data.variable 
    583583 
    584584        :param data: a data table used to score the feature 
     
    589589         
    590590        :param weightID: meta feature used to weight individual data instances 
    591         :type weightID: Orange.data.feature 
     591        :type weightID: Orange.data.variable 
    592592 
    593593        """ 
  • orange/Orange/network/__init__.py

    r7591 r7660  
    16691669                     
    16701670        if results2items and not resultHistory2items: 
    1671             attrs = [Orange.data.feature.Discrete( 
     1671            attrs = [Orange.data.variable.Discrete( 
    16721672                                        'clustering label propagation', 
    16731673                                        values=list(set([l for l \ 
     
    16801680                self.net.items = Orange.data.Table([self.net.items, data]) 
    16811681        if resultHistory2items: 
    1682             attrs = [Orange.data.feature.Discrete('c'+ str(i), 
     1682            attrs = [Orange.data.variable.Discrete('c'+ str(i), 
    16831683                values=list(set([l for l in lblhistory[0]]))) for i,labels \ 
    16841684                in enumerate(lblhistory)] 
  • orange/doc/Orange/rst/code/lookup-lookup.py

    r7356 r7660  
    1111a, b, e = table.domain["a"], table.domain["b"], table.domain["e"] 
    1212 
    13 ab = Orange.data.feature.Discrete("a==b", values = ["no", "yes"]) 
     13ab = Orange.data.variable.Discrete("a==b", values = ["no", "yes"]) 
    1414ab.getValueFrom = Orange.classification.lookup.ClassifierByLookupTable(ab, a, b, 
    1515                    ["yes", "no", "no",  "no", "yes", "no",  "no", "no", "yes"]) 
    1616 
    17 e1 = Orange.data.feature.Discrete("e==1", values = ["no", "yes"]) 
     17e1 = Orange.data.variable.Discrete("e==1", values = ["no", "yes"]) 
    1818e1.getValueFrom = Orange.classification.lookup.ClassifierByLookupTable(e1, e, 
    1919                    ["yes", "no", "no", "no", "?"]) 
  • orange/doc/Orange/rst/code/lookup-table.py

    r7394 r7660  
    2424print 
    2525 
    26 y2 = Orange.data.feature.Discrete("y2", values = ["0", "1"]) 
     26y2 = Orange.data.variable.Discrete("y2", values = ["0", "1"]) 
    2727abe2 = Orange.classification.lookup.LookupLearner(y2, [a, b, e], table) 
    2828for i in abe2.sortedExamples[:10]: 
     
    3030print 
    3131 
    32 y2 = Orange.data.feature.Discrete("y2", values = ["0", "1"]) 
     32y2 = Orange.data.variable.Discrete("y2", values = ["0", "1"]) 
    3333abe2 = Orange.classification.lookup.LookupLearner(y2, [a, b], table) 
    3434for i in abe2.sortedExamples: 
  • orange/doc/Orange/rst/code/scoring-info-lenses.py

    r7510 r7660  
    5353 
    5454values = ["v%i" % i for i in range(len(table.domain[2].values)*len(table.domain[3].values))] 
    55 cartesian = Orange.data.feature.Discrete("cart", values = values) 
     55cartesian = Orange.data.variable.Discrete("cart", values = values) 
    5656cartesian.getValueFrom = Orange.classification.lookup.ClassifierByLookupTable(cartesian, table.domain[2], table.domain[3], values) 
    5757 
     
    5959 
    6060mid = Orange.core.newmetaid() 
    61 table.domain.addmeta(mid, Orange.data.feature.Discrete(values = ["v0", "v1"])) 
     61table.domain.addmeta(mid, Orange.data.variable.Discrete(values = ["v0", "v1"])) 
    6262table.addMetaAttribute(mid) 
    6363 
  • orange/fixes/fix_changed_names.py

    r7631 r7660  
    3030           "orange.Value": "Orange.data.Value", 
    3131           "orange.VarTypes": "Orange.data.Type", 
    32            "orange.Variable": "Orange.data.feature.Feature", 
    33            "orange.EnumVariable": "Orange.data.feature.Discrete", 
    34            "orange.FloatVariable": "Orange.data.feature.Continuous", 
    35            "orange.StringVariable": "Orange.data.feature.String", 
    36            "orange.PythonVariable": "Orange.data.feature.Python", 
    37            "orange.VarList": "Orange.data.feature.Features", 
    38             
    39            "orange.Distribution": "Orange.statistics.distributions.Distribution", 
    40            "orange.DiscDistribution": "Orange.statistics.distributions.DiscDistribution", 
    41            "orange.ContDistribution": "Orange.statistics.distributions.ContDistribution", 
    42            "orange.GaussianDistribution": "Orange.statistics.distributions.GaussianDistribution", 
    43            "orange.DomainDistributions": "Orange.statistics.distributions.DomainDistributions", 
    44             
    45            "orange.BasicAttrStat": "Orange.statistics.distributions.BasicStatistics", 
    46            "orange.DomainBasicAttrStat": "Orange.statistics.distributions.DomainBasicStatistics", 
    47            "orange.ContingencyAttrAttr": "Orange.statistics.distributions.ContingencyVarVar", 
    48            "orange.ContingencyClass": "Orange.statistics.distributions.ContingencyClass", 
    49            "orange.ContingencyAttrClass": "Orange.statistics.distributions.ContingencyVarClass", 
    50            "orange.ContingencyClassAttr": "Orange.statistics.distributions.ContingencyClassVar", 
    51            "orange.DomainContingency": "Orange.statistics.distributions.DomainContingency", 
     32           "orange.Variable": "Orange.data.variable.Variable", 
     33           "orange.EnumVariable": "Orange.data.variable.Discrete", 
     34           "orange.FloatVariable": "Orange.data.variable.Continuous", 
     35           "orange.StringVariable": "Orange.data.variable.String", 
     36           "orange.PythonVariable": "Orange.data.variable.Python", 
     37           "orange.VarList": "Orange.data.variable.Variables", 
     38            
     39           "orange.Distribution": "Orange.statistics.distribution.Distribution", 
     40           "orange.DiscDistribution": "Orange.statistics.distribution.Discrete", 
     41           "orange.ContDistribution": "Orange.statistics.distribution.Continuous", 
     42           "orange.GaussianDistribution": "Orange.statistics.distribution.Gaussian", 
     43           "orange.DomainDistributions": "Orange.statistics.distribution.Domain", 
     44            
     45           "orange.BasicAttrStat": "Orange.statistics.basic.Variable", 
     46           "orange.DomainBasicAttrStat": "Orange.statistics.basic.Domain", 
     47            
     48           "orange.ContingencyAttrAttr": "Orange.statistics.contingency.VarVar", 
     49           "orange.ContingencyClass": "Orange.statistics.contingency.Class", 
     50           "orange.ContingencyAttrClass": "Orange.statistics.contingency.VarClass", 
     51           "orange.ContingencyClassAttr": "Orange.statistics.contingency.ClassVar", 
     52           "orange.DomainContingency": "Orange.statistics.contingency.Domain", 
    5253           
    5354           "orange.MeasureAttribute": "Orange.feature.scoring.Measure",  
Note: See TracChangeset for help on using the changeset viewer.