Ignore:
Timestamp:
03/02/11 13:20:16 (3 years ago)
Author:
markotoplak
Branch:
default
Convert:
6e3688830a02afdbec09218ebe10ee9e3bed6cdc
Message:

Modified Orange.ensemble.forest so it does not use the TreeLearner.instance() anymore.

File:
1 edited

Legend:

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

    r7687 r7720  
    2121    # tree learner assembled as suggested by Brieman (2001) 
    2222    smallTreeLearner = Orange.classification.tree.TreeLearner( 
    23     storeNodeClassifier = 0, storeContingencies=0,  
    24     storeDistributions=1, minExamples=5).instance() 
     23    storeNodeClassifier=0, storeContingencies=0,  
     24    storeDistributions=1, minExamples=5) 
     25 
     26    smallTreeLearner.split = smallTreeLearner.build_split() 
    2527     
    2628    smallTreeLearner.split.discreteSplitConstructor.measure = measure 
     
    103105        """ 
    104106         
    105          
    106         # If there is no learner we create our own 
    107          
    108 #        if not self.learner: 
    109 #             
    110 #            # tree learner assembled as suggested by Brieman (2001) 
    111 #            smallTreeLearner = Orange.classification.tree.TreeLearner( 
    112 #            storeNodeClassifier = 0, storeContingencies=0,  
    113 #            storeDistributions=1, minExamples=5).instance() 
    114 #             
    115 #            # Use MSE on continuous class and Gini on discreete 
    116 #            if instances.domain.class_var.var_type == Orange.data.variable.Continuous.Continuous: 
    117 #                smallTreeLearner.split.discreteSplitConstructor.measure = \ 
    118 #                    smallTreeLearner.split.continuousSplitConstructor.measure =\ 
    119 #                        Orange.feature.scoring.MSE() 
    120 #            else: 
    121 #                smallTreeLearner.split.discreteSplitConstructor.measure = \ 
    122 #                    smallTreeLearner.split.continuousSplitConstructor.measure =\ 
    123 #                        Orange.feature.scoring.Gini() 
    124 #             
    125 #            smallTreeLearner.split = SplitConstructor_AttributeSubset(\ 
    126 #                    smallTreeLearner.split, self.attributes, self.rand) 
    127 #            self.learner = smallTreeLearner 
    128107        if not self.learner: 
    129108            # Use MSE on continuous class and Gini on discreete 
     
    136115         
    137116        # if number of features for subset is not set, use square root 
    138         if hasattr(learner.split, 'attributes') and\ 
    139                     not learner.split.attributes: 
    140             learner.split.attributes = int(sqrt(\ 
    141                     len(instances.domain.attributes))) 
     117 
     118        if hasattr(learner.split, 'attributes') and \ 
     119            not learner.split.attributes: 
     120            learner.split.attributes = \ 
     121                int(sqrt(len(instances.domain.attributes))) 
    142122 
    143123        self.rand.setstate(self.randstate) #when learning again, set the same state 
Note: See TracChangeset for help on using the changeset viewer.