Rewrite of the Algorithm 2 from [1].
The main goal here is to get "fanatically faithful" transcript of the algo into java. Therefore, performance and memory optimizations are neither done nor planned here.
Deviations from original notation:
- java list/arrays are zero-based
- tree is represented by recursive structure of nodes, each is either a leaf or a split node with yes, no, and other props
- the path (stored in variable "m") has long-named properties to make the thing more readable
Bugfixes:
- [bugfix1] in EXTEND, iteration misses newly added element, causing wrong computation - see [2]
- [bugfix2] in UNWIND, iteration exceeds into removed element, causing exception
Resources:
- [1] Consistent Individualized Feature Attribution for Tree Ensembles - https://arxiv.org/pdf/1802.03888.pdf
- [2] From local explanations to global understanding with explainable AI for trees, pages 65,66 - https://www.nature.com/articles/s42256-019-0138-9.epdf?shared_access_token=RCYPTVkiECUmc0CccSMgXtRgN0jAjWel9jnR3ZoTv0O81kV8DqPb2VXSseRmof0Pl8YSOZy4FHz5vMc3xsxcX6uT10EzEoWo7B-nZQAHJJvBYhQJTT1LnJmpsa48nlgUWrMkThFrEIvZstjQ7Xdc5g%3D%3D