Changeset 9525:4ecaecab0671 in orange


Ignore:
Timestamp:
01/09/12 20:56:36 (2 years ago)
Author:
markotoplak
Branch:
default
Convert:
738752a0c7d4b09064ca82da7eb74891fde3fa34
Message:

Used the same get_meta_id everywhere.

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • docs/reference/rst/Orange.data.domain.rst

    r9524 r9525  
    143143 
    144144     >>> misses = Orange.data.variable.Continuous("misses") 
    145      >>> id = orange.new_meta_id() 
     145     >>> id = Orange.data.new_meta_id() 
    146146     >>> data.domain.add_meta(id, misses) 
    147147 
     
    189189     d2 = Orange.data.Domain(["a", "b", "e", "y"], domain) 
    190190     for attr in ["c", "d", "f"]: 
    191      d2.add_meta(orange.newmetaid(), domain[attr]) 
    192      d2.add_meta(orange.newmetaid(), orange.data.variable.Discrete("X")) 
     191     d2.add_meta(Orange.data.new_meta_id(), domain[attr]) 
     192     d2.add_meta(Orange.data.new_meta_id(), orange.data.variable.Discrete("X")) 
    193193     data2 = Orange.data.Table(d2, data) 
    194194 
  • docs/reference/rst/Orange.data.instance.rst

    r9524 r9525  
    127127 
    128128    ok = orange.EnumVariable("ok?", values=["no", "yes"]) 
    129     ok_id = orange.newmetaid() 
     129    ok_id = Orange.data.new_meta_id() 
    130130    data.domain.addmeta(ok_id, ok) 
    131131    data[0][ok_id] = "yes" 
  • docs/reference/rst/code/instance-metavar.py

    r9372 r9525  
    22import Orange 
    33data = Orange.data.Table("lenses") 
    4 id = Orange.data.variable.new_meta_id() 
     4id = Orange.data.new_meta_id() 
    55for inst in data: 
    66    inst[id] = random.random() 
  • docs/reference/rst/code/knnInstanceDistance.py

    r9372 r9525  
    66nnc.distanceConstructor = Orange.core.ExamplesDistanceConstructor_Euclidean() 
    77 
    8 did = Orange.core.newmetaid() 
     8did = Orange.data.new_meta_id() 
    99nn = nnc(table, 0, did) 
    1010 
  • docs/reference/rst/code/scoring-info-lenses.py

    r9372 r9525  
    5858print "Information gain of Cartesian product of %s and %s: %6.4f" % (table.domain[2].name, table.domain[3].name, meas(cartesian, table)) 
    5959 
    60 mid = Orange.core.newmetaid() 
     60mid = Orange.data.new_meta_id() 
    6161table.domain.add_meta(mid, Orange.data.variable.Discrete(values = ["v0", "v1"])) 
    6262table.add_meta_attribute(mid) 
  • orange/Orange/classification/logreg.py

    r9349 r9525  
    484484        # get extended Model (you should not change data) 
    485485        if weight == 0: 
    486             weight = Orange.core.newmetaid() 
     486            weight = Orange.data.new_meta_id() 
    487487            examples.addMetaAttribute(weight, 1.0) 
    488488        extended_set_of_examples = createLogRegExampleTable(examples, weight) 
     
    600600        # get extended Model (you should not change data) 
    601601        if weight == 0: 
    602             weight = Orange.core.newmetaid() 
     602            weight = Orange.data.new_meta_id() 
    603603            examples.addMetaAttribute(weight, 1.0) 
    604604        extended_examples = createLogRegExampleTable(examples, weight) 
  • orange/Orange/classification/rules.py

    r9349 r9525  
    13061306        (newDomain, targetVal) = createDichotomousClass(examples.domain, examples.domain.class_var, str(cl), negate=0) 
    13071307        newDomainmetas = newDomain.getmetas() 
    1308         newDomain.addmeta(Orange.core.newmetaid(), examples.domain.class_var) # old class as meta 
     1308        newDomain.addmeta(Orange.data.new_meta_id(), examples.domain.class_var) # old class as meta 
    13091309        dichData = examples.select(newDomain) 
    13101310        if self.argument_id: 
     
    17021702    def __call__(self, rule, instances, weights, target_class): 
    17031703        if not weights: 
    1704             weights = Orange.core.newmetaid() 
     1704            weights = Orange.data.new_meta_id() 
    17051705            instances.addMetaAttribute(weights,1.) 
    17061706            instances.domain.addmeta(weights, Orange.data.variable.\ 
    17071707                Continuous("weights-"+str(weights)), True) 
    1708         newWeightsID = Orange.core.newmetaid() 
     1708        newWeightsID = Orange.data.new_meta_id() 
    17091709        instances.addMetaAttribute(newWeightsID,1.) 
    17101710        instances.domain.addmeta(newWeightsID, Orange.data.variable.\ 
     
    17271727    def __call__(self, rule, instances, weights, target_class): 
    17281728        if not weights: 
    1729             weights = Orange.core.newmetaid() 
     1729            weights = Orange.data.new_meta_id() 
    17301730            instances.addMetaAttribute(weights,1.) 
    17311731            instances.domain.addmeta(weights, Orange.data.variable.\ 
     
    17351735        except: 
    17361736            coverage = Orange.data.variable.Continuous("Coverage") 
    1737             instances.domain.addmeta(Orange.core.newmetaid(),coverage, True) 
     1737            instances.domain.addmeta(Orange.data.new_meta_id(),coverage, True) 
    17381738            instances.addMetaAttribute(coverage,0.0) 
    1739         newWeightsID = Orange.core.newmetaid() 
     1739        newWeightsID = Orange.data.new_meta_id() 
    17401740        instances.addMetaAttribute(newWeightsID,1.) 
    17411741        instances.domain.addmeta(newWeightsID, Orange.data.variable.\ 
     
    17581758    def __init__(self, examples, weight_id, target_class, apriori, argument_id): 
    17591759        self.best_rule = [None]*len(examples) 
    1760         self.prob_attribute = Orange.core.newmetaid() 
     1760        self.prob_attribute = Orange.data.new_meta_id() 
    17611761        self.apriori_prob = apriori[target_class]/apriori.abs 
    17621762        examples.addMetaAttribute(self.prob_attribute, self.apriori_prob) 
  • orange/Orange/data/io.py

    r9505 r9525  
    692692                class_indices.append(i) 
    693693            elif flag == "meta": 
    694                 mid = Orange.core.newmetaid() 
     694                mid = Orange.data.new_meta_id() 
    695695                metas[mid] = var 
    696696                meta_attribute_load_status[mid] = status 
  • orange/Orange/ensemble/boosting.py

    r8042 r9525  
    5252        """ 
    5353        import math 
    54         weight = orange.newmetaid() 
     54        weight = Orange.data.new_meta_id() 
    5555        if origWeight: 
    5656            for i in instances: 
  • orange/Orange/evaluation/reliability.py

    r9349 r9525  
    531531        nearest_neighbours_constructor.distanceConstructor = Orange.distance.instances.EuclideanConstructor() 
    532532         
    533         distance_id = Orange.core.newmetaid() 
     533        distance_id = Orange.data.new_meta_id() 
    534534        nearest_neighbours = nearest_neighbours_constructor(examples, 0, distance_id) 
    535535         
     
    598598        nearest_neighbours_constructor.distanceConstructor = Orange.distance.instances.EuclideanConstructor() 
    599599         
    600         distance_id = Orange.core.newmetaid() 
     600        distance_id = Orange.data.new_meta_id() 
    601601        nearest_neighbours = nearest_neighbours_constructor(examples, 0, distance_id) 
    602602        return CNeighboursClassifier(nearest_neighbours, self.k) 
     
    644644        nnm.distanceConstructor = Orange.distance.instances.MahalanobisConstructor() 
    645645         
    646         mid = Orange.core.newmetaid() 
     646        mid = Orange.data.new_meta_id() 
    647647        nnm = nnm(examples, 0, mid) 
    648648        return MahalanobisClassifier(self.k, nnm, mid) 
  • orange/Orange/multilabel/multiknn.py

    r9505 r9525  
    7070        nnc.distanceConstructor = Orange.core.ExamplesDistanceConstructor_Euclidean() 
    7171         
    72         weight_id = Orange.core.newmetaid() 
     72        weight_id = Orange.data.new_meta_id() 
    7373        self.knn = nnc(instances, 0, weight_id) 
    7474        self.weight_id = weight_id 
  • orange/fixes/fix_changed_names.py

    r9346 r9525  
    4646           "orange.GetProbabilities": "Orange.classification:Classifier.GetProbabilities", 
    4747           "orange.GetBoth": "Orange.classification:Classifier.GetBoth", 
     48 
     49           "orange.newmetaid": "Orange.data.new_meta_id", 
    4850            
    4951           "orange.Distribution": "Orange.statistics.distribution.Distribution", 
Note: See TracChangeset for help on using the changeset viewer.