예제 #1
0
 def __call__(self, example, resultType = orange.GetValue):
     votes = [0.] * len(self.classvar.values)
     for c, e in self.classifiers:
         votes[int(c(example))] += e
     index = orngMisc.selectBestIndex(votes)
     value = orange.Value(self.classvar, index)
     if resultType == orange.GetValue:
         return value
     sv = sum(votes)
     for i in range(len(votes)):
         votes[i] = votes[i]/sv
     if resultType == orange.GetProbabilities:
         return votes
     else:
         return (value, votes)
예제 #2
0
 def __call__(self, example, resultType=orange.GetValue):
     votes = [0.] * len(self.classVar.values)
     for c, e in self.classifiers:
         votes[int(c(example))] += e
     index = orngMisc.selectBestIndex(votes)
     value = orange.Value(self.classVar, index)
     if resultType == orange.GetValue:
         return value
     sv = sum(votes)
     for i in range(len(votes)):
         votes[i] = votes[i] / sv
     if resultType == orange.GetProbabilities:
         return votes
     else:
         return (value, votes)