Visualize Decision Tree without Graphviz.
Project description
dtreeplt
it draws Decision Tree not using Graphviz, but only matplotlib.
If interactive == True, it draws Interactive Decision Tree on Notebook.
Output Image using proposed method: dtreeplt (using only matplotlib)
Output Image using conventional method: export_graphviz (Using Graphviz)
Output Image using dtreeplt Interactive Decision Tree
Installation
If you want to use the latest version, please use them on git.
pip install git+https://github.com/nekoumei/dtreeplt.git
when it comes to update, command like below.
pip install git+https://github.com/nekoumei/dtreeplt.git -U
Requirements: see requirements.txt
Python 3.6.X.
Usage
Quick Start
from dtreeplt import dtreeplt
dtree = dtreeplt()
dtree.view()
# If you want to use interactive mode, set the parameter like below.
# dtree.view(interactive=True)
Using trained DecisionTreeClassifier
# You should prepare trained model,feature_names, target_names.
# in this example, use iris datasets.
from sklearn.datasets import load_iris
from sklearn.tree import DecisionTreeClassifier
from dtreeplt import dtreeplt
iris = load_iris()
model = DecisionTreeClassifier()
model.fit(iris.data, iris.target)
dtree = dtreeplt(
model=model,
feature_names=iris.feature_names,
target_names=iris.target_names
)
fig = dtree.view()
#if you want save figure, use savefig method in returned figure object.
#fig.savefig('output.png')
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dtreeplt-0.1.43.tar.gz.
File metadata
- Download URL: dtreeplt-0.1.43.tar.gz
- Upload date:
- Size: 6.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d28c64d8deedd74f2181ced138d3b252f2ccf56b5923bac03519d87adf9bac7b
|
|
| MD5 |
73054dd6b956ee5c291d6e482f775887
|
|
| BLAKE2b-256 |
8dde403ad62e0b27a65259fff36b9b27d46d9cb055fe7cd4ff166dfb72c4f3e5
|
File details
Details for the file dtreeplt-0.1.43-py3-none-any.whl.
File metadata
- Download URL: dtreeplt-0.1.43-py3-none-any.whl
- Upload date:
- Size: 7.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4de5dd941b124c45d9841967d8727803a1df73451455c9ab09b6153a5ad4c2c
|
|
| MD5 |
985a002003eb7cc246c295ba28e1247a
|
|
| BLAKE2b-256 |
6283d0a4af6bc35c2afe0ac141973dd5e349d2e2e2ffddc6b545e2144ad1d87b
|