Changeset 9128:e7ff70b63b12 in orange
 Timestamp:
 10/20/11 16:21:47 (2 years ago)
 Branch:
 default
 Convert:
 c9e77dc8b089468c58dd12c66f36a11450937a65
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

orange/Orange/evaluation/reliability.py
r9118 r9128 180 180 import math 181 181 import warnings 182 import numpy 182 183 183 184 from collections import defaultdict … … 209 210 BLENDING_ABSOLUTE = 9 210 211 ICV_METHOD = 10 212 MAHAL_TO_CENTER_ABSOLUTE = 13 211 213 212 214 # Type of estimator constant … … 218 220 3: "BAGV absolute", 4: "CNK signed", 5: "CNK absolute", 219 221 6: "LCV absolute", 7: "BVCK_absolute", 8: "Mahalanobis absolute", 220 9: "BLENDING absolute", 10: "ICV", 11: "RF Variance", 12: "RF Std"} 222 9: "BLENDING absolute", 10: "ICV", 11: "RF Variance", 12: "RF Std", 223 13: "Mahalanobis to center"} 221 224 222 225 select_with_repeat = Orange.core.MakeRandomIndicesMultiple() … … 658 661 return [ Estimate(mahalanobis_distance, ABSOLUTE, MAHAL_ABSOLUTE) ] 659 662 663 class MahalanobisToCenter: 664 """ 665 :rtype: :class:`Orange.evaluation.reliability.MahalanobisToCenterClassifier` 666 667 Mahalanobis distance to center estimate is defined as `mahalanobis distance <http://en.wikipedia.org/wiki/Mahalanobis_distance>`_ to the 668 centroid of the data. 669 670 671 """ 672 def __init__(self): 673 pass 674 675 def __call__(self, examples, *args): 676 distance_constructor = Orange.distance.instances.MahalanobisConstructor() 677 distance = distance_constructor(examples) 678 679 X, _, _ = examples.to_numpy() 680 example_avg = numpy.average(X, 0) 681 682 average_example = Orange.data.Instance(examples.domain, list(example_avg) + ["?"]) 683 684 return MahalanobisToCenterClassifier(distance, average_example) 685 686 class MahalanobisToCenterClassifier: 687 def __init__(self, distance, average_example): 688 self.distance = distance 689 self.average_example = average_example 690 691 def __call__(self, example, *args): 692 693 694 mahalanobis_to_center = self.distance(example, self.average_example) 695 696 return [ Estimate(mahalanobis_to_center, ABSOLUTE, MAHAL_TO_CENTER_ABSOLUTE) ] 697 698 660 699 class BaggingVarianceCNeighbours: 661 700 """
Note: See TracChangeset
for help on using the changeset viewer.