Changeset 8216:32f807123ae2 in orange


Ignore:
Timestamp:
08/18/11 12:11:39 (3 years ago)
Author:
markotoplak
Branch:
default
Convert:
1c57b1d12493186e366fd4baa177d3a36dc163e9
Message:

min_examples -> min_instances. store_examples -> store_instances.

Location:
orange
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orange/Orange/classification/tree.py

    r8197 r8216  
    18891889class TreeLearner(Orange.core.Learner): 
    18901890    """ 
    1891     A classification or regression tree learner. 
    1892     If upon initialization :class:`TreeLearner` 
    1893     is given a set of instances, then an :class:`TreeClassifier` object 
    1894     is built and returned instead. Attributes can be also be set on initialization.  
     1891    A classification or regression tree learner.  If upon 
     1892    initialization :class:`TreeLearner` is given a set of instances, 
     1893    then an :class:`TreeClassifier` object is built and returned 
     1894    instead. Attributes can be also be set on initialization. 
    18951895 
    18961896    **The tree building process** 
     
    19001900       are in a file or are fed through a filter, they are copied to a 
    19011901       table. Even if they are already in a table, they are copied if 
    1902        :obj:`store_examples` is `True`. 
     1902       :obj:`store_instances` is `True`. 
    19031903    #. Apriori class probabilities are computed. If the sum 
    19041904       of instance weights is zero, there are no instances so the process 
     
    19401940       for the subtree. 
    19411941    #. A subset of instances is stored in its corresponding tree node, 
    1942        if :obj:`store_examples` is `True`. If not, the new weight 
     1942       if :obj:`store_instances` is `True`. If not, the new weight 
    19431943       attributes are removed (if any were created). 
    19441944 
     
    20282028        The smalles number of instances in non-null leaves (default: 0). 
    20292029 
    2030     .. attribute:: min_examples 
    2031  
    2032         Data subsets with less than :obj:`min_examples` 
     2030    .. attribute:: min_instances 
     2031 
     2032        Data subsets with less than :obj:`min_instances` 
    20332033        instances are not split any further, that is, all leaves in the tree 
    20342034        will contain at least that many instances (default: 0). 
     
    20662066        :obj:`StopCriteria.__call__`. Useful for prototyping new tree 
    20672067        induction algorithms.  When used, parameters  :obj:`max_majority` 
    2068         and :obj:`min_examples` will not be  considered.  The default 
     2068        and :obj:`min_instances` will not be  considered.  The default 
    20692069        stopping criterion stops induction when all instances in a node 
    20702070        belong to the same class. 
     
    20882088    .. attribute:: store_contingencies 
    20892089     
    2090     .. attribute:: store_examples 
     2090    .. attribute:: store_instances 
    20912091     
    20922092    .. attribute:: store_node_classifier 
     
    20982098        distributions actually points to the same distribution that is 
    20992099        stored in :obj:`contingency.classes`.  By default everything 
    2100         except :obj:`store_examples` is enabled.  
     2100        except :obj:`store_instances` is enabled.  
    21012101 
    21022102    """ 
     
    22492249        if mm < 1.0: 
    22502250            stop.max_majority = self.max_majority 
    2251         me = getattr(self, "min_examples", 0) 
     2251        me = getattr(self, "min_instances", 0) 
    22522252        if me: 
    2253             stop.min_examples = self.min_examples 
     2253            stop.min_examples = self.min_instances 
    22542254        return stop 
    22552255 
     
    22602260        learner.stop = self.stop 
    22612261 
    2262         for a in ["store_distributions", "store_contingencies", "store_examples",  
     2262        for a in ["store_distributions", "store_contingencies", 
    22632263            "store_node_classifier", "node_learner", "max_depth", "contingency_computer", "descender" ]: 
    22642264            if hasattr(self, a): 
    22652265                setattr(learner, a, getattr(self, a)) 
    22662266 
     2267        if hasattr(self, "store_instances"): 
     2268            learner.store_examples = self.store_instances 
     2269 
    22672270        return learner 
    22682271 
    22692272    _built_fn = {  
    22702273            "split": [ _build_split, [ "binarization", "measure", "relief_m", "relief_k", "worst_acceptable", "min_subset" ] ], \ 
    2271             "stop": [ _build_stop, ["max_majority", "min_examples" ] ]  
     2274            "stop": [ _build_stop, ["max_majority", "min_instances" ] ]  
    22722275        } 
    22732276 
     
    22812284          "storeDistributions": "store_distributions", 
    22822285          "storeContingencies": "store_contingencies", 
    2283           "storeExamples": "store_examples", 
     2286          "storeExamples": "store_instances", 
     2287          "store_examples": "store_instances", 
    22842288          "storeNodeClassifier": "store_node_classifier", 
    22852289          "worstAcceptable": "worst_acceptable", 
    22862290          "minSubset": "min_subset", 
    22872291          "maxMajority": "max_majority", 
    2288           "minExamples": "min_examples", 
     2292          "minExamples": "min_instances", 
    22892293          "maxDepth": "max_depth", 
    2290           "nodeLearner": "node_learner" 
     2294          "nodeLearner": "node_learner", 
     2295          "min_examples": "min_instances" 
    22912296}, wrap_methods=[])(TreeLearner) 
    22922297 
  • orange/doc/Orange/rst/code/tree2.py

    r8148 r8216  
    1616tree2 = Orange.classification.tree.TreeLearner(data, max_majority=0.7) 
    1717print tree2.dump(leaf_str="%m", node_str=".") 
     18 
Note: See TracChangeset for help on using the changeset viewer.