Commits

Aleš Erjavec committed a0a6ef1

Making sure testing results are for a classification problem in Callibration Plot, Confusion Matrix, Lift Curve and ROC.

Comments (0)

Files changed (4)

Orange/OrangeWidgets/Evaluate/OWCalibrationPlot.py

         self.removeGraphs()
         self.classCombo.clear()
 
+        self.warning([0, 1])
+
+        if dres is not None and dres.class_values is None:
+            self.warning(1, "ROC cannot be used for regression results.")
+            dres = None
+
         self.dres = dres
         
         if dres and dres.test_type != TEST_TYPE_SINGLE:

Orange/OrangeWidgets/Evaluate/OWConfusionMatrix.py

         self.res = res
         self.warning([0, 1])
         self.outputBox.setEnabled(True)
-        
+
+        if res is not None and res.class_values is None:
+            self.warning(1, "Confusion Matrix cannot be used for regression results.")
+            self.res = res = None
+
         if not res:
             self.matrix = None
+            self.learnerNames = []
             self.table.setRowCount(0)
             self.table.setColumnCount(0)
             return

Orange/OrangeWidgets/Evaluate/OWLiftCurve.py

         self.testSetsQLB.clear()
         self.classifiersQLB.clear()
 
+        self.warning([0, 1])
+
+        if dres is not None and dres.class_values is None:
+            self.warning(1, "Lift Curve cannot be used for regression results.")
+            dres = None
+
         self.dres = dres
 
         if not dres:
         if dres and dres.test_type != TEST_TYPE_SINGLE:
             self.warning(0, "Lift curve is supported only for single-target prediction problems.")
             return
-        self.warning(0, None)
 
         self.defaultPerfLinePValues = []
         if self.dres <> None:

Orange/OrangeWidgets/Evaluate/OWROC.py

 
         self.closeContext()
 
+        self.warning([0, 1])
+
+        if dres is not None and dres.class_values is None:
+            self.warning(1, "ROC cannot be used for regression results.")
+            dres = None
+
         if not dres:
             self.targetClass = None
             self.classCombo.clear()
         if dres and dres.test_type != TEST_TYPE_SINGLE:
             self.warning(0, "ROC is implemented only for single-target prediction problems.")
             return
-        self.warning(0, None)
 
         self.dres = dres