Commits

Anonymous committed 5e0e4eb

Updated examples

Comments (0)

Files changed (3)

docs/rst/Orange.evaluation.reliability.rst

 for first 10 instances get printed:
 
 .. literalinclude:: code/reliability-run.py
-    :lines: 11-
+    :lines: 7-
 
 Reliability Methods
 ===================
   SIGNED = 0
   ABSOLUTE = 1
 
-Reliability estimation scoring methods
-======================================
+Reliability estimation scoring
+==============================
 
 .. autofunction:: get_pearson_r
 
 
 .. autofunction:: get_spearman_r
 
-Example of usage
-================
+Example
+=======
 
 .. literalinclude:: code/reliability-long.py
-    :lines: 11-26
+    :lines: 7-22
 
 This script prints out Pearson's R coefficient between reliability estimates
 and actual prediction errors, and a corresponding p-value, for each of the
 reliability estimation measures used by default. ::
-
+  
   Estimate               r       p
   SAvar absolute        -0.077   0.454
   SAbias signed         -0.165   0.105
-  SAbias absolute       -0.099   0.333
-  BAGV absolute          0.104   0.309
+  SAbias absolute        0.095   0.352
+  LCV absolute           0.069   0.504
+  BVCK absolute          0.060   0.562
+  BAGV absolute          0.078   0.448
   CNK signed             0.233   0.021
-  CNK absolute           0.057   0.579
-  LCV absolute           0.069   0.504
-  BVCK_absolute          0.092   0.368
+  CNK absolute           0.058   0.574
   Mahalanobis absolute   0.091   0.375
-
+  Mahalanobis to center  0.096   0.349
 
 References
 ==========
 Pevec, D., Štrumbelj, E., Kononenko, I. (2011) `Evaluating Reliability of
 Single Classifications of Neural Networks. <http://www.springerlink.com
 /content/48u881761h127r33/export-citation/>`_ *Adaptive and Natural Computing
-Algorithms*, 2011, pp. 22-30.
+Algorithms*, 2011, pp. 22-30.

docs/rst/code/reliability-long.py

 # Classes:     Orange.evaluation.reliability.Learner
 
 import Orange
-Orange.evaluation.reliability.select_with_repeat.random_generator = None
-Orange.evaluation.reliability.select_with_repeat.randseed = 42
-
-import Orange
 prostate = Orange.data.Table("prostate.tab")
 
 knn = Orange.classification.knn.kNNLearner()
 print
 print "Estimate               r       p"
 for estimate in reliability_res:
-    print "%-20s %7.3f %7.3f" % (Orange.evaluation.reliability.METHOD_NAME[estimate[3]],
+    print "%-21s%7.3f %7.3f" % (Orange.evaluation.reliability.METHOD_NAME[estimate[3]],
                                  estimate[0], estimate[1])
 
 reliability = Orange.evaluation.reliability.Learner(knn, estimators=[Orange.evaluation.reliability.SensitivityAnalysis()])
 print
 print "Estimate               r       p"
 for estimate in reliability_res:
-    print "%-20s %7.3f %7.3f" % (Orange.evaluation.reliability.METHOD_NAME[estimate[3]],
+    print "%-21s%7.3f %7.3f" % (Orange.evaluation.reliability.METHOD_NAME[estimate[3]],
                                  estimate[0], estimate[1])
 
 indices = Orange.data.sample.SubsetIndices2(prostate, p0=0.7)
 train = prostate.select(indices, 0)
 test = prostate.select(indices, 1)
 
-reliability = Orange.evaluation.reliability.Learner(knn, icv=True)
-res = Orange.evaluation.testing.learn_and_test_on_test_data([reliability], train, test)
+reliability = Orange.evaluation.reliability.Learner(knn, estimators=[Orange.evaluation.reliability.ICV()])
+reliabilityc = reliability(train)
+res = Orange.evaluation.testing.test_on_data([reliabilityc], train, test)
+
+METHOD_NAME = Orange.evaluation.reliability.METHOD_NAME
 
 print
-print "Method used in internal cross-validation: ", Orange.evaluation.reliability.METHOD_NAME[res.results[0].probabilities[0].reliability_estimate[0].method]
+print "Method used in internal cross-validation: ", METHOD_NAME[reliabilityc.estimation_classifiers[0].chosen[0]]
 
 top5 = sorted((abs(result.probabilities[0].reliability_estimate[0].estimate), id) for id, result in enumerate(res.results))[:5]
 for estimate, id in top5:

docs/rst/code/reliability-run.py

 # Classes:     Orange.evaluation.reliability.Learner
 
 import Orange
-Orange.evaluation.reliability.select_with_repeat.random_generator = None
-Orange.evaluation.reliability.select_with_repeat.randseed = 42
-
-import Orange
 housing = Orange.data.Table("housing.tab")
 
 knn = Orange.classification.knn.kNNLearner()