Ignore:
Timestamp:
01/06/13 00:27:59 (16 months ago)
Author:
blaz <blaz.zupan@…>
Branch:
default
Message:

new tutorial

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/tutorial/rst/code/bagging.py

    r9374 r11051  
    33# Referenced:  c_bagging.htm 
    44 
    5 import orange, random 
     5import random 
     6import Orange 
    67 
    78def Learner(examples=None, **kwds): 
     
    3738        self.__dict__.update(kwds) 
    3839 
    39     def __call__(self, example, resultType = orange.GetValue): 
     40    def __call__(self, example, resultType = Orange.classification.Classifier.GetValue): 
    4041        freq = [0.] * len(self.domain.classVar.values) 
    4142        for c in self.classifiers: 
    4243            freq[int(c(example))] += 1 
    4344        index = freq.index(max(freq)) 
    44         value = orange.Value(self.domain.classVar, index) 
     45        value = Orange.data.Value(self.domain.classVar, index) 
    4546        for i in range(len(freq)): 
    4647            freq[i] = freq[i]/len(self.classifiers) 
    47         if resultType == orange.GetValue: return value 
    48         elif resultType == orange.GetProbabilities: return freq 
     48        if resultType == Orange.classification.Classifier.GetValue: return value 
     49        elif resultType == Orange.classification.Classifier.GetProbabilities: return freq 
    4950        else: return (value, freq) 
    5051         
Note: See TracChangeset for help on using the changeset viewer.