v <- c(0,0,0,0,0,0,1,0,0,1,3,4,6,8,10)
delta <- c(0.3,0.1,0,0.6,0,0,0,0,0,0,0,0,0,0,0)
coalitionweightedshapleyvalue(v, delta, binary=TRUE)
v <- c(0,0,0,0,0,0,0,0,1,4,1,3,6,8,10)
delta <- c(0.25,0.25,0.25,0.25)
a <- coalitionweightedshapleyvalue(v, delta, game=TRUE)
b <- coalitionweightedshapleyvalue(a$game, delta, game=TRUE)
c <- coalitionweightedshapleyvalue(b$game, delta, game=TRUE)
plotcoresets(rbind(v, a$game, b$game, c$game), imputations=FALSE)
# Games a, b and c have the same Shapley value:
all(sapply(list(a$value, b$value, c$value, shapleyvalue(v)),
function(x) all.equal(x, a$value) == TRUE))
Run the code above in your browser using DataLab