1.0 - 8.00 - Shapley Value Functions Example 2 Step 3 - Teradata Vantage

Teradata® Vantage Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
1.0
8.00
Release Date
May 2019
Content Type
Programming Reference
Publication ID
B700-4003-098K
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;

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
... ... ...