1.1 - 8.10 - Shapley Value Functions Example: nPath Creates ShapleyGenerateCombination; Step 3 - Teradata Vantage

Teradata Vantage™ - Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.1
8.10
Release Date
October 2019
Content Type
Programming Reference
Publication ID
B700-4003-079K
Language
English (United States)

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;
SELECT comb, size, CAST("value" AS NUMERIC(3,2)) FROM attrib_cvs ORDER BY size,comb;
 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
 1 4 5        3  0.70
 2 3 4        3  0.90
 2 3 5        3  1.00
 2 4 5        3  0.80
 3 4 5        3  1.00
 1 2 3 4      4  0.90
 1 2 3 5      4  0.80
 1 2 4 5      4  1.00
 1 3 4 5      4  1.00
 2 3 4 5      4  0.60
 1 2 3 4 5    5  0.30