Changeset 7977:2bf528d07b2b in orange


Ignore:
Timestamp:
06/03/11 13:14:49 (3 years ago)
Author:
ales_erjavec <ales.erjavec@…>
Branch:
default
Convert:
0fa1b77843fe412bb352e70902f91581f54fe58e
Message:

Fixed a error with bayes model printing.

Location:
orange
Files:
2 edited

Legend:

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

    r7919 r7977  
    378378        classes=" "*20+ ((' %10s'*nValues) % tuple([i[:10] for i in self.classVar.values])) 
    379379         
    380         return "\n".join( 
     380        return "\n".join([ 
    381381            classes, 
    382382            "class probabilities "+(frmtStr % tuple(self.distribution)), 
    383383            "", 
    384             "\n".join(["\n".join( 
     384            "\n".join(["\n".join([ 
    385385                "Attribute " + i.variable.name, 
    386386                classes, 
    387387                "\n".join( 
    388388                    ("%20s" % i.variable.values[v][:20]) + (frmtStr % tuple(i[v])) 
    389                     for v in xrange(len(i.variable.values))) 
    390                 ) for i in self.conditionalDistributions])) 
     389                    for v in xrange(len(i.variable.values)))] 
     390                ) for i in self.conditionalDistributions])]) 
    391391             
    392392 
  • orange/orngBayes.py

    r7919 r7977  
    1 from Orange import NaiveLearner as BayesLearner, NaiveClassifier as BayesClassifier 
     1from Orange.classification.bayes import NaiveLearner as BayesLearner, NaiveClassifier as BayesClassifier 
     2from Orange.core import BayesClassifier as _BayesClassifier 
    23 
    34def printModel(bayesclassifier): 
     
    56    DEPRECATED. Replaced by :obj:`BayesClassifier.dump`. 
    67    """ 
    7     print(model if isinstance(model, TreeClassifier) else NaiveClassifier(model)) 
     8    if isinstance(bayesclassifier, BayesClassifier): 
     9        print bayesclassifier 
     10    elif isinstance(bayesclassifier, _BayesClassifier): 
     11        print BayesClassifier(bayesclassifier) 
     12    else: 
     13        raise TypeError 
Note: See TracChangeset for help on using the changeset viewer.