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