You can use the export_text
function from the sklearn.tree
module to get the decision rules for a decision tree in scikit-learn. Here is an example:
main.py341 chars14 lines
Output:
main.py644 chars20 lines
The decision rules show the conditions for each split in the tree, and the corresponding class that resulting samples belong to.
gistlibby LogSnag