Shapley Value Functions Example 1 Step 2 - 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 2 adds one player to each combination.

Using the output of the ShapleyGenerateCombination function, the ShapleyAddOnePlayer function computes the divisor value by adding one player to each combination. The divisor is key to the calculation of the final Shapley numbers.

SQL Call

CREATE MULTISET TABLE project_addone_cost AS (
  SELECT * FROM ShapleyAddOnePlayer (
    ON project_comb_cost
    USING
    CombinationColumn ('comb')
    SizeColumn ('size')
    ValueColumn ('value_col')
    NumPlayers (3)
  ) AS dt
) WITH DATA;

Output

comb1 comb2 player size value divisor
1 1 2 2 1 3000 2
1 1 3 3 1 3000 2
1 2 1 2 3 3 2 14000 1
1 3 1 2 3 2 2 13000 1
2 1 2 1 1 13000 2
2 2 3 3 1 13000 2
2 3 1 2 3 1 2 19000 1
3 1 3 1 1 10000 2
3 2 3 2 1 10000 2
  1 1 0 0 1
  2 2 0 0 1
  3 3 0 0 1