Skip to content

Latest commit

 

History

History
35 lines (26 loc) · 1.23 KB

File metadata and controls

35 lines (26 loc) · 1.23 KB

Shapley Value Methods for Attribution Modeling (Naive, Set-based)

A Python implementation of "Shapley Value Methods for Attribution Modeling in Online Advertising" by Zhao, et al.

How to use:

  1. Clone this repository
git clone https://github.com/ianchute/shapley-attribution-model.git
  1. Import one of the two Shapley Attribution Models
  from simplified_shapley_attribution_model import SimplifiedShapleyAttributionModel
  1. Initialize the model
model = SimplifiedShapleyAttributionModel()
  1. Feed customer journeys into the model (represented by list of lists of integers, where each integer represents a channel, product, or other object that can be attributed to a certain event). Sample data can be found in the data folder.
import json
with open("data/sample.json", "r") as f:
  journeys = json.load(f)
result = model.attribute(journeys)
  1. The result is a dictionary of attributions (keys are channels, values are attribution scores; for OrderedShapleyAttributionModel, a list of attributions is returned - one for each touchpoint in the journey)

Available models:

  1. SimplifiedShapleyAttributionModel
  2. OrderedShapleyAttributionModel