API Documentation
- class decisiontree_to_sankey.DecisionTree_to_Sankey(clf, X)
Bases:
objectClass to visualize a trained decision tree (regression or classification) as a Plotly-based Sankey diagram.
- Parameters:
clf (DecisionTreeClassifier or DecisionTreeRegressor) – Trained decision tree model (classifier or regressor) from scikit-learn.
X (pd.DataFrame) – Training dataset used to grab the feature names for visualizing the tree.
- clf
The trained decision tree model.
- Type:
DecisionTreeClassifier or DecisionTreeRegressor
- tree_
The internal tree structure of the trained model.
- Type:
Tree
- feature_names
Names of the features in the training data.
- Type:
pd.Index
- is_classifier
Whether the model is a classifier.
- Type:
bool
- outcomes
Class labels (for classifiers) or None for regressors.
- Type:
array or None
- create_sankey(title='Decision Tree Sankey Diagram')
Generates and displays a Plotly Sankey diagram based on the decision tree.
- create_sankey(title='Decision Tree Sankey Diagram')
Creates a Sankey diagram showing the structure of the decision tree.
- Parameters:
title (str, optional) – The title of the Sankey diagram. Default is “Decision Tree Sankey Diagram”.