Trees
The Trees module extracts branches and rules from a trained forest. It supports scikit-learn and PySpark models.
Signature
Trees(
backend="sklearn",
n_sample_multiplier=0.05,
ef_sample_multiplier=10,
max_depth=None,
)
Main functions
get_branches(X, y, model=None): returns the forest branches. Whenmodelis not provided, the forest is trained internally.plot_importances(model): generates an importance plot for quick diagnostics.
Typical usage
from InsideForest import Trees
trees = Trees("sklearn", n_sample_multiplier=0.05, ef_sample_multiplier=10)
branches = trees.get_branches(X, y, fitted_model)
Key parameters
- backend:
"sklearn"or"pyspark"depending on the forest type. - n_sample_multiplier: controls the sample used to evaluate rules.
- ef_sample_multiplier: adjusts exploratory sampling to discover additional regions.
- max_depth: limits depth while extracting rules.
The output feeds into Regions and Labels. See Performance Tips for parameter guidance.