When calling print on a hybrid_policy_tree leaf nodes are given node labels according to the order in which the hybrid tree is grown, which will be breadth first for each subtree. However, predict with option type = “node.id” would give node labels according to an “ordinary” breadth first. This PR fixes the predicted node labels to match up with how they are printed.
This should ideally not be a breaking change for anyone that uses predict(hybrid.tree, type = “node.id”), as the group each observation belongs to is correct, it will just be given a different label that matches up with what’s printed. (i.e. code that relies on sample Xi belonging to group g = A_i will not break as long as it doesn’t rely on whether g is called A_i, “banana”, or 42,...)
(just updating the printed leaf labels for hybrid tree is too much of a hassle, this fix is simpler and should be perfectly fine with the above caveat)
When calling
print
on ahybrid_policy_tree
leaf nodes are given node labels according to the order in which the hybrid tree is grown, which will be breadth first for each subtree. However,predict
with optiontype = “node.id”
would give node labels according to an “ordinary” breadth first. This PR fixes the predicted node labels to match up with how they are printed.This should ideally not be a breaking change for anyone that uses
predict(hybrid.tree, type = “node.id”)
, as the group each observation belongs to is correct, it will just be given a different label that matches up with what’s printed. (i.e. code that relies on sample Xi belonging to group g = A_i will not break as long as it doesn’t rely on whether g is called A_i, “banana”, or 42,...)(just updating the printed leaf labels for hybrid tree is too much of a hassle, this fix is simpler and should be perfectly fine with the above caveat)