Commits

Miha Stajdohar  committed d8b4594

Fixed bugs with new architecture.

  • Participants
  • Parent commits 5119c78

Comments (0)

Files changed (3)

File _modelmaps/modelmap.py

                      instance_predictions,
                      instance_classes)
 
-    def build_projection_model(self, attributes, visualizationMethod=vr.LINEAR_PROJECTION):
+    def build_projection_model(self, attributes, visualizationMethod):
         """Build a projection meta-model."""
 
         method = "?"

File _modelmaps/widgets/OWModelMap.py

 
 import scipy.stats
 
-import Orange
-import orange
 import orngVizRank
 import orngStat
 
 import OWColorPalette
 import OWNxCanvasQt
 
+from Orange import classification, data, feature, misc
+
 from orngScaleLinProjData import *
 from OWNxExplorer import *
 from OWkNNOptimization import OWVizRank
 
     def set_tooltip_attributes(self, attributes):
         if self.graph is None or self.items is None or \
-           not isinstance(self.items, orange.ExampleTable):
+           not isinstance(self.items, data.Table):
             return
 
         attributes = ["Cluster CA", "label", "CA", "attributes"]
             for i in range(len(ICON_SIZES) - 1):
                 if int(ICON_SIZES[i]) < v.size() <= int(ICON_SIZES[i + 1]):
                     size = ICON_SIZES[i]
-            imageKey = items[v.index()]['model'].value + size
+            imageKey = items[v.index()]['type'].value + size
             if imageKey not in MODEL_IMAGES:
                 imageKey = "MISSING"
 
         OWNxExplorer.__init__(self, parent, signalManager, name,
                                NetworkCanvas=OWModelMapCanvas)
 
-        self.inputs = [("Distances", orange.SymMatrix, self.setMatrix, Default),
-                       ("Model Subset", orange.ExampleTable, self.setSubsetModels)]
-        self.outputs = [("Model", orange.Example),
-                        ("Classifier", orange.Classifier),
-                        ("Selected Models", orange.ExampleTable)]
+        self.inputs = [("Distances", misc.SymMatrix, self.setMatrix, Default),
+                       ("Model Subset", data.Table, self.setSubsetModels)]
+        self.outputs = [("Model", data.Instance),
+                        ("Classifier", classification.Classifier),
+                        ("Selected Models", data.Table)]
 
         self.vertexSize = 32
         self.autoSendSelection = False
 
             if 'YAnchors' in modelInfo and 'XAnchors' in modelInfo:
                 if not modelInstance.domain.hasmeta('anchors'):
-                    modelInstance.domain.addmeta(orange.newmetaid(), orange.PythonVariable('anchors'))
+                    modelInstance.domain.addmeta(feature.Descriptor.new_meta_id(), feature.Python('anchors'))
                 modelInstance['anchors'] = (modelInfo['XAnchors'], modelInfo['YAnchors'])
 
             if 'classifier' in modelInfo and modelInfo['classifier'] is not None:
                 if not modelInstance.domain.hasmeta('classifier'):
-                    modelInstance.domain.addmeta(orange.newmetaid(), orange.PythonVariable('classifier'))
+                    modelInstance.domain.addmeta(feature.Descriptor.new_meta_id(), feature.Python('classifier'))
                 modelInstance['classifier'] = modelInfo['classifier']
                 self.send('Classifier', modelInfo['classifier'])
 
     mroot = '%snew\\' % root
     matrix, labels, data = OWModelFile.readMatrix('%s%s.npy' % (mroot, modelName))
     if os.path.exists('%s%s.tab' % (mroot, modelName)):
-        matrix.items = orange.ExampleTable('%s%s.tab' % (mroot, modelName))
+        matrix.items = data.Table('%s%s.tab' % (mroot, modelName))
     else:
         print 'ExampleTable %s not found!\n' % ('%s%s.tab' % (mroot, modelName))
     if os.path.exists('%s%s.res' % (mroot, modelName)):
         print 'Results pickle %s not found!\n' % \
               ('%s%s.res' % (mroot, modelName))
 
-    matrix.originalData = Orange.data.Table('%stab\\zoo.tab' % root)
+    matrix.originalData = data.Table('%stab\\zoo.tab' % root)
     ow.setMatrix(matrix)
     appl.exec_()
 

File examples/projections.py

 import orngVizRank as vr
 
-import mm
+import Orange.modelmaps as mm
 
-ROOT = "/home/miha/work/res/modelmap/"
+ROOT = "/home/miha/work/res/modelmaps/"
+
 build_map = mm.BuildModelMap(ROOT + "tab/zoo.tab")
 
 nfeatures = len(build_map.data_d.domain.features)