Shapley Value Functions Example 2 Step 3 - 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 3 computes the Shapley value for each player (CVS).

CREATE MULTISET TABLE attrib_cvs AS (
  SELECT * FROM ShapleyGenerateCombination (
    ON (
      SELECT attrconv.ind, (attrconv.num_conv/(1.0*attrtot.num_tot))
      FROM attrconv INNER JOIN attrtot ON attrconv.ind = attrtot.ind
    )
  ) AS dt
) WITH DATA;

This query returns the following table:

SELECT comb, size, CAST("value" AS NUMERIC(3,2)) FROM attrib_cvs ORDER BY size,comb;
attrib_cvs
comb size value
1 1 0.80
2 1 0.90
3 1 0.90
4 1 0.90
5 1 0.90
1 2 2 0.80
1 3 2 1.00
1 4 2 0.90
1 5 2 0.90
2 3 2 0.90
2 4 2 0.80
2 5 2 0.80
3 4 2 0.90
3 5 2 0.80
4 5 2 0.80
1 2 3 3 0.70
1 2 4 3 1.00
1 2 5 3 0.80
1 3 4 3 1.00
1 3 5 3 0.40
... ... ...