Shapley Value Functions Example 2 Step 5 - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
8.00
1.0
Published
May 2019
Language
English (United States)
Last Update
2019-11-22
dita:mapPath
blj1506016597986.ditamap
dita:ditavalPath
blj1506016597986.ditaval
dita:id
B700-4003
lifecycle
previous
Product Category
Teradata Vantageā„¢

Step 5 computes the unnormalized Shapley values from the CVS and ACVS.

This query returns the following table:

SELECT player, SUM(partial_avg) / 5 AS shapley_value FROM (
  SELECT player, size, SUM(partial_value) AS partial_avg FROM (
    SELECT player,
      (attrib_cvs."value" - attrib_acvs."value") / divisor AS partial_value,
      attrib_acvs.size AS size
      FROM attrib_cvs INNER JOIN attrib_acvs ON (attrib_cvs.comb = attrib_acvs.comb2
    )
  ) AS stratum GROUP BY player, size
) AS stratum_avg GROUP BY player ORDER BY player;
player shapley value
1 0.08666666944821676
2 0.036666669944922126
3 0.04499999781449636
4 0.11166666299104691
5 0.020000011722246813