nuget server logo nuget api documents
↑

API Docs / Microsoft.VisualBasic.Math.Statistics / ShapAlgo2

ShapAlgo2

Full name Microsoft.VisualBasic.Math.Statistics.ShapleyValue.TreeShap.ShapAlgo2 Assembly Microsoft.VisualBasic.Math.Statistics Members 3

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:

00 Remarks

https://github.com/pkozelka/treeshap

01 Syntax

Microsoft.VisualBasic.Math.Statistics.ShapleyValue.TreeShap.ShapAlgo2

02 Methods

NameOverloadsSummary
unwind 1 Removes i-th element of the path, and redistributes all weights
compute 1

03 Fields

NameOverloadsSummary
DEBUG 1

04 Members

method unwind #
unwind(IList(Of PathElement), Int32)

Removes i-th element of the path, and redistributes all weights

Parameters
NameTypeDescription
origMIList(Of PathElement)

elements of decision path

iInt32

zero-based index to be removed

Returns

transformed decision path

field DEBUG #
DEBUG
method compute #
compute(Double(), PkTree)