Shapley Value Functions Example: ShapleyGenerateCombination, ShapleyAddOnePlayer; Step 2 - Teradata Vantage

Machine Learning Engine Analytic Function Reference

Product
Teradata Vantage
Release Number
9.02
9.01
2.0
1.3
Published
February 2022
Language
English (United States)
Last Update
2022-02-10
dita:mapPath
rnn1580259159235.ditamap
dita:ditavalPath
ybt1582220416951.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')
	NumPlayers(3)
  )AS dt 
) WITH DATA;

Output

select * from project_addone_cost order by 1;
 comb1 comb2 player size value   divisor 
 ----- ----- ------ ---- ------- ------- 
 NULL  2     2         0     0.0       1
 NULL  3     3         0     0.0       1
 NULL  1     1         0     0.0       1
 1     1 3   3         1  3000.0       2
 1     1 2   2         1  3000.0       2
 1 2   1 2 3 3         2 14000.0       1
 1 3   1 2 3 2         2 13000.0       1
 2     1 2   1         1 13000.0       2
 2     2 3   3         1 13000.0       2
 2 3   1 2 3 1         2 19000.0       1
 3     2 3   2         1 10000.0       2
 3     1 3   1         1 10000.0       2