Changeset 10570:77b10f404f3b in orange


Ignore:
Timestamp:
03/18/12 23:18:54 (2 years ago)
Author:
Martin Mozina <martin.mozina@…>
Branch:
default
Message:

Removed some bugs related to ABCN2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Orange/classification/rules.py

    r10519 r10570  
    622622                progress.start = progress.end 
    623623                progress.end += step 
    624  
    625624            aes = self.get_argumented_examples(dich_data) 
    626625            aes = self.sort_arguments(aes, dich_data) 
     
    10021001        self.default_value = default_value 
    10031002    def __call__(self, examples, weight_id=0): 
    1004         return Orange.classification.ConstantClassifier(self.default_value, defaultDistribution=Orange.statistics.Distribution(examples.domain.class_var, examples, weight_id)) 
     1003        return Orange.classification.ConstantClassifier(self.default_value, defaultDistribution=Orange.statistics.distribution.Distribution(examples.domain.class_var, examples, weight_id)) 
    10051004 
    10061005class ABCN2Ordered(ABCN2): 
     
    16521651                    tempRule = oldRule.clone() 
    16531652                    tempRule.filter.conditions.append( 
    1654                         Orange.data.filter.Discrete( 
     1653                        Orange.data.filter.ValueFilterDiscrete( 
    16551654                            position=i, 
    16561655                            values=[Orange.data.Value(data.domain[i], v)], 
     
    16871686    def getTempRule(self, oldRule, pos, oper, ref, target_class, atIndex): 
    16881687        tempRule = oldRule.clone() 
    1689  
    16901688        tempRule.filter.conditions.append( 
    16911689            Orange.data.filter.ValueFilterContinuous( 
     
    17141712        self.indices = getattr(filter,"indices",[]) 
    17151713        if not self.indices and len(filter.conditions)>0: 
    1716             self.indices = RuleCoversArguments.filterIndices(filter) 
     1714            self.indices = CoversArguments.filterIndices(filter) 
    17171715        self.argument_id = argument_id 
    17181716        self.domain = self.filter.domain 
     
    17221720         
    17231721    def condIn(self,cond): # is condition in the filter? 
    1724         condInd = RuleCoversArguments.conditionIndex(cond) 
     1722        condInd = CoversArguments.conditionIndex(cond) 
    17251723        if operator.or_(condInd,self.indices[cond.position]) == self.indices[cond.position]: 
    17261724            return True 
     
    18301828        prob_dist = Orange.core.DistributionList() 
    18311829        for tex in res.results: 
    1832             d = Orange.statistics.Distribution(examples.domain.class_var) 
     1830            d = Orange.statistics.distribution.Distribution(examples.domain.class_var) 
    18331831            for di in range(len(d)): 
    18341832                d[di] = tex.probabilities[0][di] 
     
    19181916        self.rules = rules 
    19191917        self.examples = examples 
    1920         self.apriori = Orange.statistics.Distribution(examples.domain.class_var, examples, weight_id) 
     1918        self.apriori = Orange.statistics.distribution.Distribution(examples.domain.class_var, examples, weight_id) 
    19211919        self.apriori_prob = [a / self.apriori.abs for a in self.apriori] 
    19221920        self.weight_id = weight_id 
     
    19271925    def __call__(self, example, result_type=Orange.classification.Classifier.GetValue, ret_rules=False): 
    19281926        example = Orange.data.Instance(self.examples.domain, example) 
    1929         tempDist = Orange.statistics.Distribution(example.domain.class_var) 
     1927        tempDist = Orange.statistics.distribution.Distribution(example.domain.class_var) 
    19301928        best_rules = [None] * len(example.domain.class_var.values) 
    19311929 
     
    19521950                if r: 
    19531951                    tmp_examples = r.filter(tmp_examples) 
    1954             tmpDist = Orange.statistics.Distribution(tmp_examples.domain.class_var, tmp_examples, self.weight_id) 
     1952            tmpDist = Orange.statistics.distribution.Distribution(tmp_examples.domain.class_var, tmp_examples, self.weight_id) 
    19551953            tmpDist.normalize() 
    19561954            probs = [0.] * len(self.examples.domain.class_var.values) 
    19571955            for i in range(len(self.examples.domain.class_var.values)): 
    19581956                probs[i] = tmpDist[i] + tempDist[i] * 2 
    1959             final_dist = Orange.statistics.Distribution(self.examples.domain.class_var) 
     1957            final_dist = Orange.statistics.distribution.Distribution(self.examples.domain.class_var) 
    19601958            for cl_i, cl in enumerate(self.examples.domain.class_var): 
    19611959                final_dist[cl] = probs[cl_i] 
Note: See TracChangeset for help on using the changeset viewer.