Changeset 7939:bcc62c74a64e in orange


Ignore:
Timestamp:
05/25/11 12:23:25 (3 years ago)
Author:
markotoplak
Branch:
default
Convert:
200299bfbba5c532b7f81b4ccf573c3734e88a68
Message:

Ensemble.py: converted to Orange 2.5. Classification tree: m_pruning instead of mForPruning.

Location:
orange
Files:
2 edited

Legend:

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

    r7906 r7939  
    22312231        in a node belong to the same class. 
    22322232 
    2233     .. attribute:: mForPruning 
     2233    .. attribute:: m_pruning 
    22342234 
    22352235        If non-zero, invokes an error-based bottom-up post-pruning, 
     
    22952295        if getattr(self, "sameMajorityPruning", 0): 
    22962296            tree = Pruner_SameMajority(tree) 
    2297         if getattr(self, "mForPruning", 0): 
    2298             tree = Pruner_m(tree, m=self.mForPruning) 
     2297        if getattr(self, "m_pruning", 0): 
     2298            tree = Pruner_m(tree, m=self.m_pruning) 
    22992299 
    23002300        return TreeClassifier(baseClassifier=tree)  
     
    23942394 
    23952395        return learner 
     2396 
     2397 
     2398TreeLearner = Orange.misc.deprecated_members({ 
     2399          "mForPruning": "m_pruning", 
     2400}, wrap_methods=[])(TreeLearner) 
    23962401 
    23972402# 
  • orange/doc/Orange/rst/code/ensemble.py

    r7399 r7939  
    55# Referenced:  orngEnsemble.htm 
    66 
    7 import Orange, orngTree 
    8 import orngTest, orngStat 
     7import Orange 
    98 
    10 tree = orngTree.TreeLearner(mForPruning=2, name="tree") 
     9tree = Orange.classification.tree.TreeLearner(m_pruning=2, name="tree") 
    1110bs = Orange.ensemble.boosting.BoostedLearner(tree, name="boosted tree") 
    1211bg = Orange.ensemble.bagging.BaggedLearner(tree, name="bagged tree") 
     
    1514 
    1615learners = [tree, bs, bg] 
    17 results = orngTest.crossValidation(learners, table, folds=3) 
     16results = Orange.evaluation.testing.cross_validation(learners, table, folds=3) 
    1817print "Classification Accuracy:" 
    1918for i in range(len(learners)): 
    20     print ("%15s: %5.3f") % (learners[i].name, orngStat.CA(results)[i]) 
     19    print ("%15s: %5.3f") % (learners[i].name, Orange.evaluation.scoring.CA(results)[i]) 
Note: See TracChangeset for help on using the changeset viewer.