Comments (7)
Very good, I can now do what I want! Thank you so much!
from dtreeviz.
Did you have a look at the end of the readme file and notebooks/colors.ipynb?
If it doesn't answer your question, it should be added to the documentation.
from dtreeviz.
I have and have even read source code and made some experiments, but did not get it to work. Also looked at a notebook that did some coloring, but simply did not understand it.
from dtreeviz.
Sounds like we need some simpler examples.
from dtreeviz.
Or maybe the API is just too complex. I don't know, because I still don't understand 😀
from dtreeviz.
Right now the documentation says about the class colors:
classes
needs to be a list of lists of colors with a minimum length of your number of colors. The index is the number of classes and the list with this index needs to have the same amount of colors.
The usage would be
class_colors = [None, # 0 classes
None, # 1 class
["#FEFEBB","#a1dab4"], # 2 classes
["#ff0000","#00ff00",'#0000ff'], # colors were changed here
["#FEFEBB","#D9E6F5",'#a1dab4','#fee090'], # 4
["#FEFEBB","#D9E6F5",'#a1dab4','#41b6c4','#fee090'], # 5
["#FEFEBB",'#c7e9b4','#41b6c4','#2c7fb8','#fee090','#f46d43'], # 6
["#FEFEBB",'#c7e9b4','#7fcdbb','#41b6c4','#225ea8','#fdae61','#f46d43'], # 7
["#FEFEBB",'#edf8b1','#c7e9b4','#7fcdbb','#1d91c0','#225ea8','#fdae61','#f46d43'], # 8 ["#FEFEBB",'#c7e9b4','#41b6c4','#74add1','#4575b4','#313695','#fee090','#fdae61','#f46d43'], # 9
["#FEFEBB",'#c7e9b4','#41b6c4','#74add1','#4575b4','#313695','#fee090','#fdae61','#f46d43','#d73027'] # 10
]
classifier = tree.DecisionTreeClassifier(max_depth=2)
iris = load_iris()
classifier.fit(iris.data, iris.target)
dtreeviz.trees.dtreeviz(classifier,
iris.data,
iris.target,
target_name='variety',
feature_names=iris.feature_names,
class_names=["setosa", "versicolor", "virginica"],
colors={'classes': class_colors}
)
Any ideas on how to improve the documentation are appreciated and I'd be happy to add it to the documentation.
from dtreeviz.
What about simplifying that example to something much more basic as a first step?
from dtreeviz.
Related Issues (20)
- Crash when leaf nodes have no samples HOT 1
- Out of memory when calling viz.view() HOT 2
- Integrate AI explanation
- CatBoost need to be supported. HOT 1
- AttributeError: module 'dtreeviz' has no attribute 'model' on Windows platform, works fine on Google colab
- tfdf.keras.CartModel support? HOT 1
- TypeError: 'int' object is not subscriptable HOT 3
- Development requirement in `setup.py` HOT 1
- Adjust Bounding Box of saved svg file
- DTreeViz crashes, if descision tree was built with objects, that are interpretable as numbers.
- How to use chinese? HOT 1
- get_score() is not implemented yet for XGBoost. HOT 1
- cannot import name 'dtreeviz' from 'dtreeviz.trees HOT 1
- VisualisationNotYetSupportedError: get_node_criterion() is not implemented yet for LightGBM
- VisualisationNotYetSupportedError: get_feature_path_importance() is not implemented yet for LightGBM
- Any way to filter features before plotting with instance_feature_importance(x,figsize=(10,12))? HOT 2
- Google Cloud Function support/how-to?
- tree visualization issue with DecisionTreeClassifiers class of PySpark MLLIB HOT 8
- change bins in classifier nodes HOT 2
- classifier tree leaf piechart radius not scaling above 100 entries
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dtreeviz.