简体   繁体   中英

How to interpret the prediction in this plot of classification tree?

在此处输入图像描述 I have followed this tutorial and was able to reproduce the results. However, the last graph confuses me. I understand most of the time it's probability, but why are there negative numbers? Since the response is Survived, how to interpret the numbers in the predictions? How to convert those numbers to Yes and No?

https://www.h2o.ai/blog/finally-you-can-plot-h2o-decision-trees-in-r/

EIDT 11/19/2019: by the way, I did find a similar post on Cross Validated. The answer was not certain since it ended with a question mark. https://stats.stackexchange.com/questions/374569/may-somebody-help-with-interpretation-of-trees-from-h2o-gbm-see-as-photo-attach

I filtered the data using the logic in the tree and looked at the unique prediction of the subset. I was able to find the threshold for 'yes' and 'no' predictions. I also changed the original code (starting line 34) so that the leaf shows the ultimate result of the numbers. However, this is just a way to hack the plot. If someone can tell me how the numbers are derived, that would be great.

    if(class(left_node)[[1]] == 'H2OLeafNode')
      leftLabel = ifelse(left_node@prediction >= threshold, 'Yes', 'No')
  else
    leftLabel = left_node@split_feature

  if(class(right_node)[[1]] == 'H2OLeafNode')
    rightLabel = ifelse(right_node@prediction >= threshold, 'Yes', 'No')
  else
    rightLabel = right_node@split_feature

Since the picture is a GBM plot, it's not as straightforward as you might like, since the inference calculation does some math on the value extracted from the leaf of the tree.

The actual code is here:

https://github.com/h2oai/h2o-3/blob/master/h2o-genmodel/src/main/java/hex/genmodel/algos/gbm/GbmMojoModel.java

Look at the score0 function.

My advice would be to build a 1-tree DRF instead, and then write a short java program and try to single-step it in a java debugger.

The java snippet to start from is how to compile and run a MOJO in this document:

http://docs.h2o.ai/h2o/latest-stable/h2o-genmodel/javadoc/index.html

If you do this, you will be able to step through the exact steps that produce the answer (for GBM as well if you prefer), and nothing will be unknown at that point.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM