Ignore:
Timestamp:
08/21/12 14:02:59 (20 months ago)
Author:
mlevar
Branch:
default
Message:

Scoring additions, preparation for Clustering Trees and multi-target addon

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/ensemble/forest.py

    r10851 r10967  
    66import copy 
    77from Orange.utils import deprecated_keywords 
     8from operator import add 
    89 
    910def _default_small_learner(attributes=None, rand=None, base=None): 
     
    2223 
    2324def _wrap_learner(base, rand, randorange): 
    24     if base == None or isinstance(base, Orange.classification.tree.SimpleTreeLearner): 
     25    if base == None or isinstance(base, Orange.classification.tree.SimpleTreeLearner) or isinstance(base, Orange.core.ClusteringTreeLearner): 
    2526        return _default_simple_learner(base, randorange) 
    2627    elif isinstance(base, Orange.classification.tree.TreeLearner): 
     
    5152_RandomForestSimpleTreeLearner = Orange.utils.deprecated_members({"weightID":"weight_id", "examples":"instances"})(_RandomForestSimpleTreeLearner) 
    5253 
    53  
    5454class _RandomForestTreeLearner(Orange.core.Learner): 
    5555    """ A learner which wraps an ordinary TreeLearner with 
     
    139139 
    140140    __new__ = Orange.utils._orange__new__(Orange.core.Learner) 
    141  
     141     
    142142    def __init__(self, trees=100, attributes=None,\ 
    143143                    name='Random Forest', rand=None, callback=None, base_learner=None, learner=None): 
     
    199199                    domain=instances.domain, class_var=instances.domain.class_var, \ 
    200200                    class_vars=instances.domain.class_vars) 
    201             
     201 
     202 
    202203RandomForestLearner = Orange.utils.deprecated_members({"examples":"instances"})(RandomForestLearner) 
    203204 
     
    249250              :class:`Orange.statistics.Distribution` or a tuple with both 
    250251        """ 
    251         from operator import add 
    252  
    253         instance = Orange.data.Instance(self.domain, instance) 
     252 
    254253        # get results to avoid multiple calls 
    255254        res_both = [c(instance, orange.GetBoth) for c in self.classifiers] 
Note: See TracChangeset for help on using the changeset viewer.