Ignore:
Timestamp:
03/14/12 00:47:06 (2 years ago)
Author:
martin@…
Branch:
default
Message:

Smashed some bugs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/classification/rules.py

    r10518 r10519  
    787787        self.rule_finder.ruleFilter = self.ruleFilter 
    788788 
    789  
    790789    def learn_normal_rule(self, examples, weight_id, apriori): 
    791790        if hasattr(self.rule_finder.evaluator, "bestRule"): 
     
    849848                    self.rule_finder.evaluator.returnExpectedProb = oldREP 
    850849                tmpList.sort(lambda x, y:-cmp(x.quality, y.quality)) 
    851                 tmpList = tmpList[:self.rule_filter.width] 
     850                tmpList = tmpList[:self.ruleFilter.width] 
    852851 
    853852                for tmpRule in tmpList: 
     
    863862                            tmpRule2.filterAndStore(examples, weight_id, r.classifier.default_val) 
    864863                            tmpRule2.complexity += 1 
    865                             if tmpRule2.class_distribution.abs < tmprule.class_distribution.abs: 
     864                            if tmpRule2.class_distribution.abs < tmpRule.class_distribution.abs: 
    866865                                tmpList2.append(tmpRule2) 
    867866                tmpList = tmpList2 
     
    12211220        return best_rules 
    12221221 
    1223  
     1222    def __call__(self, rule, examples, weights, target_class): 
    12241223        """ if example has an argument, then the rule must be consistent with the argument. """ 
    12251224        example = getattr(rule.learner, "arg_example", None) 
     
    12411240                e[self.prob_attribute] = 1.0 
    12421241        return (examples, weights) 
    1243  
    12441242 
    12451243    def covered_percentage(self, examples): 
     
    18431841    PILAR (Probabilistic improvement of learning algorithms with rules). 
    18441842    """ 
    1845     def __init__(self, alternative_learner=None, min_cl_sig=0.5, min_beta=0.0, set_prefix_rules=False, optimize_betas=True): 
     1843    def __init__(self, alternative_learner=None, min_cl_sig=0.5, min_beta=0.0, penalty=0.01, set_prefix_rules=False, optimize_betas=True): 
    18461844        self.alternative_learner = alternative_learner 
    18471845        self.min_cl_sig = min_cl_sig 
Note: See TracChangeset for help on using the changeset viewer.