Changeset 4637:49e189acfe69 in orange


Ignore:
Timestamp:
05/10/08 12:32:20 (6 years ago)
Author:
martin <martin@…>
Branch:
default
Convert:
80b949de88befb673f8f6e96b4301259ca6e44b5
Message:

fixed bug with orngLR.printOUT: if model had no attributes, method crashed

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/orngLR.py

    r4301 r4637  
    1717    # get the longest attribute name 
    1818    longest=0 
    19     for at in classifier.continuizedDomain.attributes: 
    20         if len(at.name)>longest: 
    21             longest=len(at.name); 
     19    if not classifier.continuizedDomain: # no attributes, only beta_0 
     20        longest=len("Intercept") 
     21    else: 
     22        for at in classifier.continuizedDomain.attributes: 
     23            if len(at.name)>longest: 
     24                longest=len(at.name); 
    2225 
    2326    # print out the head 
     
    2730    formatstr = "%"+str(longest)+"s %10.2f %10.2f %10.2f %10.2f"     
    2831    print formatstr % ("Intercept", classifier.beta[0], classifier.beta_se[0], classifier.wald_Z[0], classifier.P[0]) 
    29     formatstr = "%"+str(longest)+"s %10.2f %10.2f %10.2f %10.2f %10.2f"     
    30     for i in range(len(classifier.continuizedDomain.attributes)): 
    31         print formatstr % (classifier.continuizedDomain.attributes[i].name, classifier.beta[i+1], classifier.beta_se[i+1], classifier.wald_Z[i+1], abs(classifier.P[i+1]), math.exp(classifier.beta[i+1])) 
     32    formatstr = "%"+str(longest)+"s %10.2f %10.2f %10.2f %10.2f %10.2f" 
     33    if classifier.continuizedDomain: 
     34        for i in range(len(classifier.continuizedDomain.attributes)): 
     35            print formatstr % (classifier.continuizedDomain.attributes[i].name, classifier.beta[i+1], classifier.beta_se[i+1], classifier.wald_Z[i+1], abs(classifier.P[i+1]), math.exp(classifier.beta[i+1])) 
    3236         
    3337 
Note: See TracChangeset for help on using the changeset viewer.