Changeset 7906:7a53dfbdef67 in orange


Ignore:
Timestamp:
05/16/11 14:02:54 (3 years ago)
Author:
anze <anze.staric@…>
Branch:
default
Convert:
0c4b7efa5ea555a6211a4608460670704f138532
Message:

Fixed output of trees to dot format.

File:
1 edited

Legend:

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

    r7890 r7906  
    28742874            for i, branch in enumerate(node.branches): 
    28752875                if branch: 
    2876                     internalBranchName = internalName+chr(i+65) 
     2876                    internalBranchName = "%s-%d" % (internalName,i) 
    28772877                    self.fle.write('%s -> %s [ label="%s" ]\n' % \ 
    28782878                        (_quoteName(internalName),  
     
    28832883        else: 
    28842884            self.fle.write('%s [ shape=%s label="%s"]\n' % \ 
    2885                 (internalName, self.leafShape,  
     2885                (_quoteName(internalName), self.leafShape,  
    28862886                self.formatString(self.leafStr, node, parent))) 
    28872887 
     
    29672967 
    29682968    def dot(self, fileName, leafStr = "", nodeStr = "", leafShape="plaintext", nodeShape="plaintext", **argkw): 
    2969         """ Prints the tree to a file in a format used by  
     2969        """ Print the tree to a file in a format used by  
    29702970        `GraphViz <http://www.research.att.com/sw/tools/graphviz>`_. 
    29712971        Uses the same parameters as :meth:`dump` defined above 
    29722972        plus two parameters which define the shape used for internal 
    2973         nodes and laves of the tree: 
    2974  
    2975         :param leafShape: Shape of the outline around leves of the tree.  
     2973        nodes and leaves of the tree: 
     2974 
     2975        :param leafShape: Shape of the outline around leaves of the tree.  
    29762976            If "plaintext", no outline is used (default: "plaintext"). 
    29772977        :type leafShape: string 
     
    29832983        for various outlines supported by GraphViz. 
    29842984        """ 
    2985         fle = type(fileName) == str and file(fileName, "wt") or fileName 
     2985        fle = type(fileName) == str and open(fileName, "wt") or fileName 
    29862986 
    29872987        _TreeDumper(leafStr, nodeStr, argkw.get("userFormats", []) +  
Note: See TracChangeset for help on using the changeset viewer.