srlearn.plotting.export_digraph¶

srlearn.plotting.export_digraph(booster, tree_index=0, out_file=None)[source]¶

Create a digraph representation of a tree.

Parameters
boosterBaseBoostedRelationalModel

Model to create a tree from

tree_indexint

Index of the tree to visualize

out_filestr, pathlike, or None

Handle or name of the output file. If None, returns a string

Examples

This can be used in two ways: returning a string, or directly writing the result to a file.

from srlearn.rdn import BoostedRDNClassifier
from srlearn import Background
from srlearn.datasets import load_toy_cancer
from srlearn.plotting import export_digraph

train, _ = load_toy_cancer()

bkg = Background(
    modes=train.modes,
)

clf = BoostedRDNClassifier(
    background=bkg,
    target="cancer",
)

clf.fit(train)

print(export_digraph(clf, tree_index=0))

Examples using srlearn.plotting.export_digraph¶

Estimating Feature Importance

Estimating Feature Importance

Estimating Feature Importance
Family Relationships Domain

Family Relationships Domain

Family Relationships Domain