Changeset 9936:08300d990d26 in orange


Ignore:
Timestamp:
02/07/12 18:14:08 (2 years ago)
Author:
markotoplak
Branch:
default
rebase_source:
dcc1bddbbae14a1e234a7d18a813ea0fb1d2bb93
Message:

moved new_meta_ide from feature to feature.Descriptor

Files:
17 edited

Legend:

Unmodified
Added
Removed
  • Orange/classification/logreg.py

    r9929 r9936  
    254254        # get extended Model (you should not change data) 
    255255        if weight == 0: 
    256             weight = Orange.feature.new_meta_id() 
     256            weight = Orange.feature.Descriptor.new_meta_id() 
    257257            instances.addMetaAttribute(weight, 1.0) 
    258258        extended_set_of_examples = createLogRegExampleTable(instances, weight) 
     
    377377        # get extended Model (you should not change data) 
    378378        if weight == 0: 
    379             weight = Orange.feature.new_meta_id() 
     379            weight = Orange.feature.Descriptor.new_meta_id() 
    380380            instances.addMetaAttribute(weight, 1.0) 
    381381        extended_examples = createLogRegExampleTable(instances, weight) 
  • Orange/classification/rules.py

    r9929 r9936  
    13351335        (newDomain, targetVal) = create_dichotomous_class(examples.domain, examples.domain.class_var, str(cl), negate=0) 
    13361336        newDomainmetas = newDomain.getmetas() 
    1337         newDomain.addmeta(Orange.feature.new_meta_id(), examples.domain.class_var) # old class as meta 
     1337        newDomain.addmeta(Orange.feature.Descriptor.new_meta_id(), examples.domain.class_var) # old class as meta 
    13381338        dichData = examples.select(newDomain) 
    13391339        if self.argument_id: 
     
    17311731    def __call__(self, rule, instances, weights, target_class): 
    17321732        if not weights: 
    1733             weights = Orange.feature.new_meta_id() 
     1733            weights = Orange.feature.Descriptor.new_meta_id() 
    17341734            instances.addMetaAttribute(weights, 1.) 
    17351735            instances.domain.addmeta(weights, Orange.feature.\ 
    17361736                Continuous("weights-" + str(weights)), True) 
    1737         newWeightsID = Orange.feature.new_meta_id() 
     1737        newWeightsID = Orange.feature.Descriptor.new_meta_id() 
    17381738        instances.addMetaAttribute(newWeightsID, 1.) 
    17391739        instances.domain.addmeta(newWeightsID, Orange.feature.\ 
     
    17561756    def __call__(self, rule, instances, weights, target_class): 
    17571757        if not weights: 
    1758             weights = Orange.feature.new_meta_id() 
     1758            weights = Orange.feature.Descriptor.new_meta_id() 
    17591759            instances.addMetaAttribute(weights, 1.) 
    17601760            instances.domain.addmeta(weights, Orange.feature.\ 
     
    17641764        except: 
    17651765            coverage = Orange.feature.Continuous("Coverage") 
    1766             instances.domain.addmeta(Orange.feature.new_meta_id(), coverage, True) 
     1766            instances.domain.addmeta(Orange.feature.Descriptor.new_meta_id(), coverage, True) 
    17671767            instances.addMetaAttribute(coverage, 0.0) 
    1768         newWeightsID = Orange.feature.new_meta_id() 
     1768        newWeightsID = Orange.feature.Descriptor.new_meta_id() 
    17691769        instances.addMetaAttribute(newWeightsID, 1.) 
    17701770        instances.domain.addmeta(newWeightsID, Orange.feature.\ 
     
    17871787    def __init__(self, examples, weight_id, target_class, apriori, argument_id): 
    17881788        self.best_rule = [None] * len(examples) 
    1789         self.prob_attribute = Orange.feature.new_meta_id() 
     1789        self.prob_attribute = Orange.feature.Descriptor.new_meta_id() 
    17901790        self.apriori_prob = apriori[target_class] / apriori.abs 
    17911791        examples.addMetaAttribute(self.prob_attribute, self.apriori_prob) 
  • Orange/data/io.py

    r9929 r9936  
    693693                class_indices.append(i) 
    694694            elif flag == "meta": 
    695                 mid = Orange.feature.new_meta_id() 
     695                mid = Orange.feature.Descriptor.new_meta_id() 
    696696                metas[mid] = var 
    697697                meta_attribute_load_status[mid] = status 
  • Orange/data/utils.py

    r9929 r9936  
    162162        yield str(uuid.uuid4()) 
    163163 
    164 from Orange.feature import new_meta_id 
     164import Orange.feature 
     165new_meta_id = Orange.feature.Descriptor.new_meta_id 
    165166 
    166167_row_meta_id = new_meta_id() 
  • Orange/ensemble/boosting.py

    r9929 r9936  
    5252        """ 
    5353        import math 
    54         weight = Orange.feature.new_meta_id() 
     54        weight = Orange.feature.Descriptor.new_meta_id() 
    5555        if orig_weight: 
    5656            for i in instances: 
  • Orange/evaluation/reliability.py

    r9929 r9936  
    402402        nearest_neighbours_constructor.distanceConstructor = Orange.distance.Euclidean() 
    403403         
    404         distance_id = Orange.feature.new_meta_id() 
     404        distance_id = Orange.feature.Descriptor.new_meta_id() 
    405405        nearest_neighbours = nearest_neighbours_constructor(instances, 0, distance_id) 
    406406         
     
    469469        nearest_neighbours_constructor.distanceConstructor = Orange.distance.Euclidean() 
    470470         
    471         distance_id = Orange.feature.new_meta_id() 
     471        distance_id = Orange.feature.Descriptor.new_meta_id() 
    472472        nearest_neighbours = nearest_neighbours_constructor(instances, 0, distance_id) 
    473473        return CNeighboursClassifier(nearest_neighbours, self.k) 
     
    516516        nnm.distanceConstructor = Orange.distance.Mahalanobis() 
    517517         
    518         mid = Orange.feature.new_meta_id() 
     518        mid = Orange.feature.Descriptor.new_meta_id() 
    519519        nnm = nnm(instances, 0, mid) 
    520520        return MahalanobisClassifier(self.k, nnm, mid) 
  • Orange/feature/__init__.py

    r9919 r9936  
    1616from Orange.core import StringVariable as String 
    1717 
    18 from Orange.core import newmetaid as new_meta_id 
    1918from Orange.core import VarTypes as Type 
    2019 
  • Orange/fixes/fix_changed_names.py

    r9923 r9936  
    4141           "orange.PythonVariable": "Orange.feature.Python", 
    4242 
    43            "orange.newmetaid": "Orange.feature.new_meta_id", 
     43           "orange.newmetaid": "Orange.feature:Variable.new_meta_id" 
    4444 
    4545           "orange.SymMatrix": "Orange.misc.SymMatrix", 
  • Orange/multilabel/multiknn.py

    r9929 r9936  
    7070        nnc.distanceConstructor = Orange.distance.Euclidean() 
    7171         
    72         weight_id = Orange.feature.new_meta_id() 
     72        weight_id = Orange.feature.Descriptor.new_meta_id() 
    7373        self.knn = nnc(instances, 0, weight_id) 
    7474        self.weight_id = weight_id 
  • Orange/testing/unit/tests/test_evaluation.py

    r9927 r9936  
    44import Orange 
    55 
    6 example_no = Orange.feature.new_meta_id() 
     6example_no = Orange.feature.Descriptor.new_meta_id() 
    77 
    88class DummyLearner(Orange.classification.majority.MajorityLearner): 
     
    6666            inst[self.example_no] = i 
    6767 
    68         self.preprocessed_with_both = Orange.feature.new_meta_id() 
    69         self.preprocessed_with_learn = Orange.feature.new_meta_id() 
    70         self.preprocessed_with_test = Orange.feature.new_meta_id() 
    71         self.preprocessed_with_learn_test = Orange.feature.new_meta_id() 
     68        self.preprocessed_with_both = Orange.feature.Descriptor.new_meta_id() 
     69        self.preprocessed_with_learn = Orange.feature.Descriptor.new_meta_id() 
     70        self.preprocessed_with_test = Orange.feature.Descriptor.new_meta_id() 
     71        self.preprocessed_with_learn_test = Orange.feature.Descriptor.new_meta_id() 
    7272        self.preprocessors = (("B", DummyPreprocessor(self.preprocessed_with_both)), 
    7373                              ("L", DummyPreprocessor(self.preprocessed_with_learn)), 
  • docs/reference/rst/Orange.data.domain.rst

    r9929 r9936  
    160160 
    161161     >>> misses = Orange.feature.Continuous("misses") 
    162      >>> id = Orange.feature.new_meta_id() 
     162     >>> id = Orange.feature.Descriptor.new_meta_id() 
    163163     >>> data.domain.add_meta(id, misses) 
    164164 
     
    205205 
    206206    new_domain = Orange.data.Domain(["feathers", "legs"], domain) 
    207     new_domain.add_meta(Orange.feature.new_meta_id(), domain["type"]) 
    208     new_domain.add_meta(Orange.feature.new_meta_id(), domain["legs"]) 
     207    new_domain.add_meta(Orange.feature.Descriptor.new_meta_id(), domain["type"]) 
     208    new_domain.add_meta(Orange.feature.Descriptor.new_meta_id(), domain["legs"]) 
    209209    new_domain.add_meta( 
    210         Orange.feature.new_meta_id(), Orange.feature.Discrete("X")) 
     210        Orange.feature.Descriptor.new_meta_id(), Orange.feature.Discrete("X")) 
    211211    data2 = Orange.data.Table(new_domain, data) 
    212212 
     
    396396 
    397397         Register a meta attribute with the given id (see 
    398          :obj:`Orange.feature.new_meta_id`). The same meta attribute should 
     398         :obj:`Orange.feature.Descriptor.new_meta_id`). The same meta attribute should 
    399399         have the same id in all domains in which it is registered. :: 
    400400 
    401              >>> newid = Orange.feature.new_meta_id() 
     401             >>> newid = Orange.feature.Descriptor.new_meta_id() 
    402402             >>> domain.add_meta(newid, Orange.feature.String("origin")) 
    403403             >>> data[55]["origin"] = "Nepal" 
  • docs/reference/rst/Orange.data.instance.rst

    r9929 r9936  
    5353attributes. Meta attributes are hence not addressed by positions, 
    5454but by their id's, which are represented by negative indices. Id's are 
    55 generated by function :obj:`Orange.feature.new_meta_id()`. Id's can 
     55generated by function :obj:`Orange.feature.Descriptor.new_meta_id()`. Id's can 
    5656be reused for multiple domains. 
    5757 
     
    126126 
    127127    ok = orange.EnumVariable("ok?", values=["no", "yes"]) 
    128     ok_id = Orange.feature.new_meta_id() 
     128    ok_id = Orange.feature.Descriptor.new_meta_id() 
    129129    data.domain.addmeta(ok_id, ok) 
    130130    data[0][ok_id] = "yes" 
  • docs/reference/rst/Orange.feature.descriptor.rst

    r9929 r9936  
    5959        For instance, when a tab-delimited contains meta attributes and 
    6060        the existing variables are reused, they will have this id 
    61         (instead of a new one assigned by :obj:`Orange.feature.new_meta_id()`). 
     61        (instead of a new one assigned by :obj:`Orange.feature.Descriptor.new_meta_id()`). 
    6262 
    6363    .. attribute:: attributes 
  • docs/reference/rst/code/instance-metavar.py

    r9929 r9936  
    22import Orange 
    33lenses = Orange.data.Table("lenses") 
    4 id = Orange.feature.new_meta_id() 
     4id = Orange.feature.Descriptor.new_meta_id() 
    55for inst in lenses: 
    66    inst[id] = random.random() 
  • docs/reference/rst/code/instance_merge.py

    r9929 r9936  
    1818new_domain = Orange.data.Domain([a1, a3, m1, n1]) 
    1919new_domain.addmeta(m2i, m2) 
    20 new_domain.addmeta(Orange.feature.new_meta_id(), a2) 
    21 new_domain.addmeta(Orange.feature.new_meta_id(), n2) 
     20new_domain.addmeta(Orange.feature.Descriptor.new_meta_id(), a2) 
     21new_domain.addmeta(Orange.feature.Descriptor.new_meta_id(), n2) 
    2222 
    2323merge = Orange.data.Instance(new_domain, [data1[0], data2[0]]) 
  • docs/reference/rst/code/knnInstanceDistance.py

    r9929 r9936  
    66nnc.distanceConstructor = Orange.core.ExamplesDistanceConstructor_Euclidean() 
    77 
    8 did = Orange.feature.new_meta_id() 
     8did = Orange.feature.Descriptor.new_meta_id() 
    99nn = nnc(lenses, 0, did) 
    1010 
  • docs/reference/rst/code/scoring-info-lenses.py

    r9929 r9936  
    5858print "Information gain of Cartesian product of %s and %s: %6.4f" % (lenses.domain[2].name, lenses.domain[3].name, meas(cartesian, lenses)) 
    5959 
    60 mid = Orange.feature.new_meta_id() 
     60mid = Orange.feature.Descriptor.new_meta_id() 
    6161lenses.domain.add_meta(mid, Orange.feature.Discrete(values = ["v0", "v1"])) 
    6262lenses.add_meta_attribute(mid) 
Note: See TracChangeset for help on using the changeset viewer.