Changeset 7901:46a881ac9e74 in orange


Ignore:
Timestamp:
05/13/11 10:30:29 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
a2ad77b9b626a57a861b1f5b3850b681454d6f15
Message:

Added reduce methods to classifier classes in Orange.ensemble.* (due to a changed init parameters).

Location:
orange/Orange/ensemble
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/ensemble/bagging.py

    r7660 r7901  
    132132                prob = defaultdict(float) 
    133133                for c, p in votes: 
    134                     try: 
     134                    try:  
    135135                        prob[float(c)] += p[c] / wsum 
    136136                    except IndexError: # p[c] sometimes fails with index error 
     
    142142                pred = sum([float(c) for c in votes]) / wsum 
    143143                return self.classVar(pred) 
     144             
     145    def __reduce__(self): 
     146        return type(self), (self.classifiers, self.name, self.classVar), dict(self.__dict__) 
     147     
  • orange/Orange/ensemble/boosting.py

    r7897 r7901  
    146146        else: 
    147147            return (value, votes) 
     148         
     149    def __reduce__(self): 
     150        return type(self), (self.classifiers, self.name, self.classVar), dict(self.__dict__) 
    148151     
  • orange/Orange/ensemble/forest.py

    r7792 r7901  
    240240            elif resultType == orange.GetProbabilities: return cprob 
    241241            else: return (cvalue, cprob) 
     242             
     243    def __reduce__(self): 
     244        return type(self), (self.classifiers, self.name, self.domain, self.classVar), dict(self.__dict__) 
    242245 
    243246### MeasureAttribute_randomForests 
Note: See TracChangeset for help on using the changeset viewer.