Lan Zagar committed 2d04b46

Tasks do not need to be indices.

Comments (0)

Files changed (2)


     :return: Dictionary with task identifiers and corresponding data sets.
-    task_indices = [int(ins[task_id]) for ins in data]
-    return {ind:, ind)
-            for ind in sorted(set(task_indices))}
+    tasks = [ins[task_id].value for ins in data]
+    t2i = {t: ind for ind, t in enumerate(sorted(set(tasks)))}
+    task_indices = [t2i[t] for t in tasks]
+    return {t:, t2i[t])
+            for t in sorted(t2i.keys())}
 def get_groups(domain, feat_att=None):
     if feat_att is None and domain.features and domain.features[0].attributes:
         self.classifiers = classifiers
     def __call__(self, instance, return_type=Orange.core.GetValue):
-        return self.classifiers[int(instance['task'])](instance, return_type)
+        return self.classifiers[instance['task'].value](instance, return_type)


     def __call__(self, instance, return_type=Orange.core.GetValue):
         ins =, instance)
-        t = int(ins['task'])
+        t = self.tasks.index(ins['task'].value)
         f = dot(self.W[:, t], ins.native()[:-1])
         if self.intercepts:
             f += self.intercepts[t]