Git Product home page Git Product logo

Comments (7)

DJCordhose avatar DJCordhose commented on September 13, 2024 1

Very good, I can now do what I want! Thank you so much!

from dtreeviz.

Ashafix avatar Ashafix commented on September 13, 2024

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.

DJCordhose avatar DJCordhose commented on September 13, 2024

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.

parrt avatar parrt commented on September 13, 2024

Sounds like we need some simpler examples.

from dtreeviz.

DJCordhose avatar DJCordhose commented on September 13, 2024

Or maybe the API is just too complex. I don't know, because I still don't understand 😀

from dtreeviz.

Ashafix avatar Ashafix commented on September 13, 2024

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.

DJCordhose avatar DJCordhose commented on September 13, 2024

What about simplifying that example to something much more basic as a first step?

from dtreeviz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.