boofun.visualization.decision_tree_export
Decision Tree Export Utilities.
This module provides utilities for exporting Boolean function decision trees to various formats including: - Text/ASCII representation - Graphviz DOT format - JSON structure - LaTeX/TikZ code
Functions
|
Build a decision tree for a Boolean function. |
|
Export decision tree as Graphviz DOT format. |
|
Export decision tree as JSON structure. |
|
Export decision tree as ASCII text. |
|
Export decision tree as LaTeX TikZ code. |
Classes
|
Class for exporting decision trees in multiple formats. |
|
Represents a node in a decision tree. |
- boofun.visualization.decision_tree_export.export_decision_tree_text(f: BooleanFunction, var_names: List[str] | None = None, max_depth: int | None = None) str[source]
Export decision tree as ASCII text.
- Parameters:
f – Boolean function
var_names – Variable names (default: x_0, x_1, …)
max_depth – Maximum depth
- Returns:
ASCII representation
- boofun.visualization.decision_tree_export.export_decision_tree_dot(f: BooleanFunction, var_names: List[str] | None = None, max_depth: int | None = None, graph_name: str = 'DecisionTree') str[source]
Export decision tree as Graphviz DOT format.
- Parameters:
f – Boolean function
var_names – Variable names
max_depth – Maximum depth
graph_name – Name for the graph
- Returns:
DOT format string
- boofun.visualization.decision_tree_export.export_decision_tree_json(f: BooleanFunction, var_names: List[str] | None = None, max_depth: int | None = None) Dict[str, Any][source]
Export decision tree as JSON structure.
- Parameters:
f – Boolean function
var_names – Variable names
max_depth – Maximum depth
- Returns:
JSON-serializable dictionary
- boofun.visualization.decision_tree_export.export_decision_tree_tikz(f: BooleanFunction, var_names: List[str] | None = None, max_depth: int | None = None) str[source]
Export decision tree as LaTeX TikZ code.
- Parameters:
f – Boolean function
var_names – Variable names
max_depth – Maximum depth
- Returns:
TikZ code string
- class boofun.visualization.decision_tree_export.DecisionTreeExporter(f: BooleanFunction, var_names: List[str] | None = None, max_depth: int | None = None)[source]
Class for exporting decision trees in multiple formats.
Provides a unified interface for exporting Boolean function decision trees to various formats.
- __init__(f: BooleanFunction, var_names: List[str] | None = None, max_depth: int | None = None)[source]
Initialize exporter.
- Parameters:
f – Boolean function
var_names – Variable names
max_depth – Maximum depth for tree
- property tree: DecisionTreeNode
Get the decision tree (built lazily).