1.1 - 8.10 - Shapley Value Functions Example: ShapleyGenerateCombination, ShapleyAddOnePlayer; Step 2 - 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 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