Classification Tree Diagram from H2O Mojo/Pojo












2















This question draws heavily from the solution to this question as a jumping off point.
Given that I can use R to produce a mojo model object:



library(h2o)
h2o.init()
airlinedf <- h2o.importFile("http://s3.amazonaws.com/h2o-public-test-data/smalldata/airlines/allyears2k_headers.zip")
airlinemodel <- h2o.gbm(model_id = "airlinemodel",
training_frame = airlinedf,
x = c("Year", "Month", "DayofMonth", "DayOfWeek", "UniqueCarrier"),
y = "IsDepDelayed",
max_depth = 3,
ntrees = 5)
h2o.download_mojo(airlinemodel, getwd(), FALSE)


And bash/graphviz to produce a tree diagram of that model:



java -cp h2o.jar hex.genmodel.tools.PrintMojo --tree 0 -i airlinemodel.zip -o airlinemodel.gv
dot -Tpng airlinemodel.gv -o airlinemodel.png


Example GBM Tree Diagram
My question is three fold:





  1. How do I explain the values and decisions in this visualization and the values at the terminal nodes? What are the NAs in the second tier? If the values in the terminal nodes are "class probabilities", how can they be negative?




    1. Is there a way to visualize or conceptualize a "summary tree" of all the trees in the model?


    2. How can I produce a diagram to use color or shape to indicate the binary classification assignments of items in the end node?













share|improve this question

























  • for your first question please take a look at this question which asked the same thing: stats.stackexchange.com/questions/374569/…. thanks!

    – Lauren
    Nov 19 '18 at 21:08
















2















This question draws heavily from the solution to this question as a jumping off point.
Given that I can use R to produce a mojo model object:



library(h2o)
h2o.init()
airlinedf <- h2o.importFile("http://s3.amazonaws.com/h2o-public-test-data/smalldata/airlines/allyears2k_headers.zip")
airlinemodel <- h2o.gbm(model_id = "airlinemodel",
training_frame = airlinedf,
x = c("Year", "Month", "DayofMonth", "DayOfWeek", "UniqueCarrier"),
y = "IsDepDelayed",
max_depth = 3,
ntrees = 5)
h2o.download_mojo(airlinemodel, getwd(), FALSE)


And bash/graphviz to produce a tree diagram of that model:



java -cp h2o.jar hex.genmodel.tools.PrintMojo --tree 0 -i airlinemodel.zip -o airlinemodel.gv
dot -Tpng airlinemodel.gv -o airlinemodel.png


Example GBM Tree Diagram
My question is three fold:





  1. How do I explain the values and decisions in this visualization and the values at the terminal nodes? What are the NAs in the second tier? If the values in the terminal nodes are "class probabilities", how can they be negative?




    1. Is there a way to visualize or conceptualize a "summary tree" of all the trees in the model?


    2. How can I produce a diagram to use color or shape to indicate the binary classification assignments of items in the end node?













share|improve this question

























  • for your first question please take a look at this question which asked the same thing: stats.stackexchange.com/questions/374569/…. thanks!

    – Lauren
    Nov 19 '18 at 21:08














2












2








2


0






This question draws heavily from the solution to this question as a jumping off point.
Given that I can use R to produce a mojo model object:



library(h2o)
h2o.init()
airlinedf <- h2o.importFile("http://s3.amazonaws.com/h2o-public-test-data/smalldata/airlines/allyears2k_headers.zip")
airlinemodel <- h2o.gbm(model_id = "airlinemodel",
training_frame = airlinedf,
x = c("Year", "Month", "DayofMonth", "DayOfWeek", "UniqueCarrier"),
y = "IsDepDelayed",
max_depth = 3,
ntrees = 5)
h2o.download_mojo(airlinemodel, getwd(), FALSE)


And bash/graphviz to produce a tree diagram of that model:



java -cp h2o.jar hex.genmodel.tools.PrintMojo --tree 0 -i airlinemodel.zip -o airlinemodel.gv
dot -Tpng airlinemodel.gv -o airlinemodel.png


Example GBM Tree Diagram
My question is three fold:





  1. How do I explain the values and decisions in this visualization and the values at the terminal nodes? What are the NAs in the second tier? If the values in the terminal nodes are "class probabilities", how can they be negative?




    1. Is there a way to visualize or conceptualize a "summary tree" of all the trees in the model?


    2. How can I produce a diagram to use color or shape to indicate the binary classification assignments of items in the end node?













share|improve this question
















This question draws heavily from the solution to this question as a jumping off point.
Given that I can use R to produce a mojo model object:



library(h2o)
h2o.init()
airlinedf <- h2o.importFile("http://s3.amazonaws.com/h2o-public-test-data/smalldata/airlines/allyears2k_headers.zip")
airlinemodel <- h2o.gbm(model_id = "airlinemodel",
training_frame = airlinedf,
x = c("Year", "Month", "DayofMonth", "DayOfWeek", "UniqueCarrier"),
y = "IsDepDelayed",
max_depth = 3,
ntrees = 5)
h2o.download_mojo(airlinemodel, getwd(), FALSE)


And bash/graphviz to produce a tree diagram of that model:



java -cp h2o.jar hex.genmodel.tools.PrintMojo --tree 0 -i airlinemodel.zip -o airlinemodel.gv
dot -Tpng airlinemodel.gv -o airlinemodel.png


Example GBM Tree Diagram
My question is three fold:





  1. How do I explain the values and decisions in this visualization and the values at the terminal nodes? What are the NAs in the second tier? If the values in the terminal nodes are "class probabilities", how can they be negative?




    1. Is there a way to visualize or conceptualize a "summary tree" of all the trees in the model?


    2. How can I produce a diagram to use color or shape to indicate the binary classification assignments of items in the end node?










r graphviz h2o gbm






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 20 '18 at 17:52









user6910411

34.4k1080104




34.4k1080104










asked Nov 19 '18 at 20:28









RealViaCauchyRealViaCauchy

1629




1629













  • for your first question please take a look at this question which asked the same thing: stats.stackexchange.com/questions/374569/…. thanks!

    – Lauren
    Nov 19 '18 at 21:08



















  • for your first question please take a look at this question which asked the same thing: stats.stackexchange.com/questions/374569/…. thanks!

    – Lauren
    Nov 19 '18 at 21:08

















for your first question please take a look at this question which asked the same thing: stats.stackexchange.com/questions/374569/…. thanks!

– Lauren
Nov 19 '18 at 21:08





for your first question please take a look at this question which asked the same thing: stats.stackexchange.com/questions/374569/…. thanks!

– Lauren
Nov 19 '18 at 21:08












1 Answer
1






active

oldest

votes


















1














There is a better way to build decision trees with H2O - without extracting MOJOs or leaving R/Python - using new Tree API (starting with 3.22.0.1). For comprehensive explanations see:




  1. Inspecting Decision Trees with H2O

  2. Finally, You can Plot H2O Decision Trees in R






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382158%2fclassification-tree-diagram-from-h2o-mojo-pojo%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    There is a better way to build decision trees with H2O - without extracting MOJOs or leaving R/Python - using new Tree API (starting with 3.22.0.1). For comprehensive explanations see:




    1. Inspecting Decision Trees with H2O

    2. Finally, You can Plot H2O Decision Trees in R






    share|improve this answer




























      1














      There is a better way to build decision trees with H2O - without extracting MOJOs or leaving R/Python - using new Tree API (starting with 3.22.0.1). For comprehensive explanations see:




      1. Inspecting Decision Trees with H2O

      2. Finally, You can Plot H2O Decision Trees in R






      share|improve this answer


























        1












        1








        1







        There is a better way to build decision trees with H2O - without extracting MOJOs or leaving R/Python - using new Tree API (starting with 3.22.0.1). For comprehensive explanations see:




        1. Inspecting Decision Trees with H2O

        2. Finally, You can Plot H2O Decision Trees in R






        share|improve this answer













        There is a better way to build decision trees with H2O - without extracting MOJOs or leaving R/Python - using new Tree API (starting with 3.22.0.1). For comprehensive explanations see:




        1. Inspecting Decision Trees with H2O

        2. Finally, You can Plot H2O Decision Trees in R







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Dec 29 '18 at 2:56









        topcheftopchef

        13.2k65091




        13.2k65091
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53382158%2fclassification-tree-diagram-from-h2o-mojo-pojo%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Tangent Lines Diagram Along Smooth Curve

            Yusuf al-Mu'taman ibn Hud

            Zucchini