Commits

Marko Toplak committed 6df3696

data.variable -> feature.

Comments (0)

Files changed (17)

Orange/__init__.py

 _import("data")
 _import("data.io")
 _import("data.sample")
-_import("data.variable")
 
 _import("network")
 

Orange/classification/logreg.py

 
         # get extended Model (you should not change data)
         if weight == 0:
-            weight = Orange.data.new_meta_id()
+            weight = Orange.feature.new_meta_id()
             instances.addMetaAttribute(weight, 1.0)
         extended_set_of_examples = createLogRegExampleTable(instances, weight)
         extended_models = [learner(extended_examples, weight) \
 
         # get extended Model (you should not change data)
         if weight == 0:
-            weight = Orange.data.new_meta_id()
+            weight = Orange.feature.new_meta_id()
             instances.addMetaAttribute(weight, 1.0)
         extended_examples = createLogRegExampleTable(instances, weight)
         extended_model = learner(extended_examples, weight)

Orange/classification/rules.py

         """
         (newDomain, targetVal) = create_dichotomous_class(examples.domain, examples.domain.class_var, str(cl), negate=0)
         newDomainmetas = newDomain.getmetas()
-        newDomain.addmeta(Orange.data.new_meta_id(), examples.domain.class_var) # old class as meta
+        newDomain.addmeta(Orange.feature.new_meta_id(), examples.domain.class_var) # old class as meta
         dichData = examples.select(newDomain)
         if self.argument_id:
             for d in dichData: # remove arguments given to other classes
         self.mult = mult
     def __call__(self, rule, instances, weights, target_class):
         if not weights:
-            weights = Orange.data.new_meta_id()
+            weights = Orange.feature.new_meta_id()
             instances.addMetaAttribute(weights, 1.)
             instances.domain.addmeta(weights, Orange.feature.\
                 Continuous("weights-" + str(weights)), True)
-        newWeightsID = Orange.data.new_meta_id()
+        newWeightsID = Orange.feature.new_meta_id()
         instances.addMetaAttribute(newWeightsID, 1.)
         instances.domain.addmeta(newWeightsID, Orange.feature.\
             Continuous("weights-" + str(newWeightsID)), True)
 
     def __call__(self, rule, instances, weights, target_class):
         if not weights:
-            weights = Orange.data.new_meta_id()
+            weights = Orange.feature.new_meta_id()
             instances.addMetaAttribute(weights, 1.)
             instances.domain.addmeta(weights, Orange.feature.\
                 Continuous("weights-" + str(weights)), True)
             coverage = instances.domain.getmeta("Coverage")
         except:
             coverage = Orange.feature.Continuous("Coverage")
-            instances.domain.addmeta(Orange.data.new_meta_id(), coverage, True)
+            instances.domain.addmeta(Orange.feature.new_meta_id(), coverage, True)
             instances.addMetaAttribute(coverage, 0.0)
-        newWeightsID = Orange.data.new_meta_id()
+        newWeightsID = Orange.feature.new_meta_id()
         instances.addMetaAttribute(newWeightsID, 1.)
         instances.domain.addmeta(newWeightsID, Orange.feature.\
             Continuous("weights-" + str(newWeightsID)), True)
     """ This class impements probabilistic covering. """
     def __init__(self, examples, weight_id, target_class, apriori, argument_id):
         self.best_rule = [None] * len(examples)
-        self.prob_attribute = Orange.data.new_meta_id()
+        self.prob_attribute = Orange.feature.new_meta_id()
         self.apriori_prob = apriori[target_class] / apriori.abs
         examples.addMetaAttribute(self.prob_attribute, self.apriori_prob)
         examples.domain.addmeta(self.prob_attribute,

Orange/data/__init__.py

 from orange import ExampleTable as Table
 from orange import Example as Instance
 from orange import Value, StringValue, Domain
-
-from orange import VarTypes as Type
-
-from orange import newmetaid as new_meta_id

Orange/data/io.py

                 class_var_load_status.append(status)
                 class_indices.append(i)
             elif flag == "meta":
-                mid = Orange.data.new_meta_id()
+                mid = Orange.feature.new_meta_id()
                 metas[mid] = var
                 meta_attribute_load_status[mid] = status
                 meta_indices.append((i, var))

Orange/data/utils.py

 
 from collections import defaultdict
 
-from Orange.data import Table, Domain, Instance, variable 
+from Orange.data import Table, Domain, Instance
+
+import feature as variable
 
 def table_map(table, attrs, exclude_special=True):
     map = defaultdict(list)
     while True:
         yield str(uuid.uuid4())
 
-from Orange.data import new_meta_id, variable
+from Orange.feature import new_meta_id
 
 _row_meta_id = new_meta_id()
 _id_variable = variable.String("Row Id")

Orange/data/variable.py

-from orange import Variable
-from orange import EnumVariable as Discrete
-from orange import FloatVariable as Continuous
-from orange import PythonVariable as Python
-from orange import StringVariable as String
-
-from orange import VarList as Variables
-
-import orange
-new_meta_id = orange.newmetaid
-make = orange.Variable.make
-retrieve = orange.Variable.get_existing
-MakeStatus = orange.Variable.MakeStatus
-del orange

Orange/ensemble/boosting.py

         
         """
         import math
-        weight = Orange.data.new_meta_id()
+        weight = Orange.feature.new_meta_id()
         if orig_weight:
             for i in instances:
                 i.setweight(weight, i.getweight(orig_weight))

Orange/evaluation/reliability.py

         nearest_neighbours_constructor = Orange.classification.knn.FindNearestConstructor()
         nearest_neighbours_constructor.distanceConstructor = Orange.distance.Euclidean()
         
-        distance_id = Orange.data.new_meta_id()
+        distance_id = Orange.feature.new_meta_id()
         nearest_neighbours = nearest_neighbours_constructor(instances, 0, distance_id)
         
         if self.k == 0:
         nearest_neighbours_constructor = Orange.classification.knn.FindNearestConstructor()
         nearest_neighbours_constructor.distanceConstructor = Orange.distance.Euclidean()
         
-        distance_id = Orange.data.new_meta_id()
+        distance_id = Orange.feature.new_meta_id()
         nearest_neighbours = nearest_neighbours_constructor(instances, 0, distance_id)
         return CNeighboursClassifier(nearest_neighbours, self.k)
 
         nnm = Orange.classification.knn.FindNearestConstructor()
         nnm.distanceConstructor = Orange.distance.Mahalanobis()
         
-        mid = Orange.data.new_meta_id()
+        mid = Orange.feature.new_meta_id()
         nnm = nnm(instances, 0, mid)
         return MahalanobisClassifier(self.k, nnm, mid)
 

Orange/multilabel/multiknn.py

         nnc = Orange.classification.knn.FindNearestConstructor()
         nnc.distanceConstructor = Orange.distance.Euclidean()
         
-        weight_id = Orange.data.new_meta_id()
+        weight_id = Orange.feature.new_meta_id()
         self.knn = nnc(instances, 0, weight_id)
         self.weight_id = weight_id
 

docs/reference/rst/Orange.data.domain.rst

 meta attributes can be added and removed at any time::
 
      >>> misses = Orange.feature.Continuous("misses")
-     >>> id = Orange.data.new_meta_id()
+     >>> id = Orange.feature.new_meta_id()
      >>> data.domain.add_meta(id, misses)
 
 This does not change the data: no attributes are added to data
 appropriate values, otherwise their value will be missing. ::
 
     new_domain = Orange.data.Domain(["feathers", "legs"], domain)
-    new_domain.add_meta(Orange.data.new_meta_id(), domain["type"])
-    new_domain.add_meta(Orange.data.new_meta_id(), domain["legs"])
+    new_domain.add_meta(Orange.feature.new_meta_id(), domain["type"])
+    new_domain.add_meta(Orange.feature.new_meta_id(), domain["legs"])
     new_domain.add_meta(
-        Orange.data.new_meta_id(), Orange.feature.Discrete("X"))
+        Orange.feature.new_meta_id(), Orange.feature.Discrete("X"))
     data2 = Orange.data.Table(new_domain, data)
 
 Domain ``new_domain`` in this example has variables ``feathers`` and
      .. method:: add_meta(id, variable, optional=0)
 
          Register a meta attribute with the given id (see
-         :obj:`Orange.data.new_meta_id`). The same meta attribute should
+         :obj:`Orange.feature.new_meta_id`). The same meta attribute should
          have the same id in all domains in which it is registered. ::
 
-             >>> newid = Orange.data.new_meta_id()
+             >>> newid = Orange.feature.new_meta_id()
              >>> domain.add_meta(newid, Orange.feature.String("origin"))
              >>> data[55]["origin"] = "Nepal"
              >>> data[55]

docs/reference/rst/Orange.data.instance.rst

 allows for conversion from Python native types::
 
     ok = orange.EnumVariable("ok?", values=["no", "yes"])
-    ok_id = Orange.data.new_meta_id()
+    ok_id = Orange.feature.new_meta_id()
     data.domain.addmeta(ok_id, ok)
     data[0][ok_id] = "yes"
 

docs/reference/rst/Orange.feature.descriptor.rst

         A proposed (but not guaranteed) meta id to be used for that variable.
         For instance, when a tab-delimited contains meta attributes and
         the existing variables are reused, they will have this id
-        (instead of a new one assigned by :obj:`Orange.data.new_meta_id()`).
+        (instead of a new one assigned by :obj:`Orange.feature.new_meta_id()`).
 
     .. attribute:: attributes
 

docs/reference/rst/code/instance-metavar.py

 import random
 import Orange
 lenses = Orange.data.Table("lenses")
-id = Orange.data.new_meta_id()
+id = Orange.feature.new_meta_id()
 for inst in lenses:
     inst[id] = random.random()
 print lenses[0]

docs/reference/rst/code/instance_merge.py

 
 new_domain = Orange.data.Domain([a1, a3, m1, n1])
 new_domain.addmeta(m2i, m2)
-new_domain.addmeta(Orange.data.new_meta_id(), a2)
-new_domain.addmeta(Orange.data.new_meta_id(), n2)
+new_domain.addmeta(Orange.feature.new_meta_id(), a2)
+new_domain.addmeta(Orange.feature.new_meta_id(), n2)
 
 merge = Orange.data.Instance(new_domain, [data1[0], data2[0]])
 print "First example: ", data1[0]

docs/reference/rst/code/knnInstanceDistance.py

 nnc = Orange.classification.knn.FindNearestConstructor()
 nnc.distanceConstructor = Orange.core.ExamplesDistanceConstructor_Euclidean()
 
-did = Orange.data.new_meta_id()
+did = Orange.feature.new_meta_id()
 nn = nnc(lenses, 0, did)
 
 print "*** Reference instance: ", lenses[0]

docs/reference/rst/code/scoring-info-lenses.py

 
 print "Information gain of Cartesian product of %s and %s: %6.4f" % (lenses.domain[2].name, lenses.domain[3].name, meas(cartesian, lenses))
 
-mid = Orange.data.new_meta_id()
+mid = Orange.feature.new_meta_id()
 lenses.domain.add_meta(mid, Orange.feature.Discrete(values = ["v0", "v1"]))
 lenses.add_meta_attribute(mid)