XCSF  1.4.7
XCSF learning classifier system
xcsf.utils.viz.TreeViz Class Reference

Visualises a GP tree with graphviz. More...

Public Member Functions

None __init__ (self, list[str] tree, str filename, str|None note=None, list[str]|None feature_names=None)
 
str label (self, str symbol)
 
str read_function (self)
 
str read_subexpr (self)
 

Data Fields

 gviz
 

Detailed Description

Visualises a GP tree with graphviz.

Definition at line 31 of file viz.py.

Constructor & Destructor Documentation

◆ __init__()

None xcsf.utils.viz.TreeViz.__init__ (   self,
list[str]  tree,
str  filename,
str | None   note = None,
list[str] | None   feature_names = None 
)
Plots a tree with graphviz, saving to a file.

Parameters
----------
tree : list[str]
    List of strings representing a GP tree.
filename : str
    Name of the output file to save the drawn tree.
note : str, optional
    Optional string to be added as a note/caption.
feature_names : list[str], optional
    Optional list of feature names.

Definition at line 34 of file viz.py.

References GPTree.pos, and GPTree.tree.

Member Function Documentation

◆ label()

str xcsf.utils.viz.TreeViz.label (   self,
str  symbol 
)
Returns the node label for a symbol.

Definition at line 65 of file viz.py.

Referenced by xcsf.utils.viz.DGPViz.draw(), xcsf.utils.viz.TreeViz.read_function(), and xcsf.utils.viz.TreeViz.read_subexpr().

Here is the caller graph for this function:

◆ read_function()

str xcsf.utils.viz.TreeViz.read_function (   self)
Parses functions.

Definition at line 75 of file viz.py.

References xcsf.utils.viz.TreeViz.gviz, xcsf.utils.viz.DGPViz.gviz, xcsf.utils.viz.TreeViz.label(), xcsf.utils.viz.DGPViz.label(), GPTree.pos, xcsf.utils.viz.TreeViz.read_function(), xcsf.utils.viz.TreeViz.read_subexpr(), and GPTree.tree.

Referenced by xcsf.utils.viz.TreeViz.read_function(), and xcsf.utils.viz.TreeViz.read_subexpr().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read_subexpr()

str xcsf.utils.viz.TreeViz.read_subexpr (   self)
Parses sub-expressions.

Definition at line 89 of file viz.py.

References xcsf.utils.viz.TreeViz.gviz, xcsf.utils.viz.DGPViz.gviz, xcsf.utils.viz.TreeViz.label(), xcsf.utils.viz.DGPViz.label(), GPTree.pos, xcsf.utils.viz.TreeViz.read_function(), and GPTree.tree.

Referenced by xcsf.utils.viz.TreeViz.read_function().

Here is the call graph for this function:
Here is the caller graph for this function:

Field Documentation

◆ gviz

xcsf.utils.viz.TreeViz.gviz

The documentation for this class was generated from the following file: