Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ianchute/shapley-attribution-model-zhao-naive
A Python implementation of "Shapley Value Methods for Attribution Modeling in Online Advertising" by Zhao, et al.
https://github.com/ianchute/shapley-attribution-model-zhao-naive
Last synced: 3 months ago
JSON representation
A Python implementation of "Shapley Value Methods for Attribution Modeling in Online Advertising" by Zhao, et al.
- Host: GitHub
- URL: https://github.com/ianchute/shapley-attribution-model-zhao-naive
- Owner: ianchute
- License: mit
- Created: 2019-12-02T06:53:28.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-04-29T13:05:51.000Z (over 4 years ago)
- Last Synced: 2024-05-13T00:09:07.818Z (6 months ago)
- Language: Python
- Homepage:
- Size: 38.1 KB
- Stars: 29
- Watchers: 3
- Forks: 13
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-marketing-machine-learning - shapley-attribution-model-zhao-naive - attribution-model-zhao-naive.svg?style=social) (Attribution)
README
## 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.](https://arxiv.org/abs/1804.05327)
**How to use:**
1. Clone this repository
```bash
git clone https://github.com/ianchute/shapley-attribution-model.git
```2. Import one of the two Shapley Attribution Models
```python
from simplified_shapley_attribution_model import SimplifiedShapleyAttributionModel
```3. Initialize the model
```python
model = SimplifiedShapleyAttributionModel()
```4. 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.
```python
import json
with open("data/sample.json", "r") as f:
journeys = json.load(f)
result = model.attribute(journeys)
```5. 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`