Ignore:
Timestamp:
03/14/12 13:37:12 (2 years ago)
Author:
markotoplak
Branch:
default
Message:

Random forests: replaced custom news with Orange.misc_orangenew.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/ensemble/forest.py

    r9919 r10525  
    3434    split is  (on average) as specified.""" 
    3535 
    36     def __new__(cls, instances = None, weight_id = 0, **argkw): 
    37         self = Orange.core.Learner.__new__(cls, **argkw) 
    38         if instances: 
    39             self.__init__(**argkw) 
    40             return self.__call__(instances, weight_id) 
    41         else: 
    42             return self 
    43        
     36    __new__ = Orange.misc._orange__new__(Orange.core.Learner) 
     37 
    4438    def __init__(self, base, rand): 
    4539        self.base = base 
     
    5448        self.base.skip_prob, self.base.random_generator = osp, orand 
    5549        return r 
     50 
    5651_RandomForestSimpleTreeLearner = Orange.misc.deprecated_members({"weightID":"weight_id", "examples":"instances"})(_RandomForestSimpleTreeLearner) 
    5752    
    58 class RandomForestLearner(orange.Learner): 
     53class RandomForestLearner(Orange.core.Learner): 
    5954    """ 
    6055    Just like in bagging, classifiers in random forests are trained from bootstrap 
     
    105100    """ 
    106101 
    107     def __new__(cls, instances=None, weight = 0, **kwds): 
    108         self = orange.Learner.__new__(cls, **kwds) 
    109         if instances: 
    110             self.__init__(**kwds) 
    111             return self.__call__(instances, weight) 
    112         else: 
    113             return self 
     102    __new__ = Orange.misc._orange__new__(Orange.core.Learner) 
    114103 
    115104    def __init__(self, trees=100, attributes=None,\ 
     
    485474    a new split constructor. 
    486475    """ 
    487     @deprecated_keywords({"weightID":"weight_id", "examples":"instances"}) 
    488     def __new__(cls, instances = None, weight_id = 0, **argkw): 
    489         self = Orange.core.Learner.__new__(cls, **argkw) 
    490         if instances: 
    491             self.__init__(**argkw) 
    492             return self.__call__(instances, weight_id) 
    493         else: 
    494             return self 
    495        
     476 
     477    __new__ = Orange.misc._orange__new__(Orange.core.Learner) 
     478      
    496479    def __init__(self, base, rand): 
    497480        self.base = base 
Note: See TracChangeset for help on using the changeset viewer.