Skip to content

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

License

Notifications You must be signed in to change notification settings

ianchute/shapley-attribution-model-zhao-naive

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages