Python package for generating MMM (Marketing Mix Model) input data
Project description
PySiMMMulator
PySiMMMulator is an open source Python adaption of the R-package siMMMulator, which allows users to generate simulated data to use in testing Marketing Mix Models (MMMs). While this package cointains a full pipeline for data generation (configurable via .conf file) it can also be utilized in parts to generate select portions of MMM input data (ie campaign/channel spend)
Installation
Accessable via PyPI
pip install pysimmmulator
Usage
PySiMMMulator's simulator can either be run on a step-by-step basis, or can be run single-shot by passing a config file.
Run via config
Run using this method, you'll be returned both a dataframe of for MMM input as well as the "True ROI" values for each of your channels. These true values are critical to validating your MMM model.
cfg = load_config(config_path="./my_config.yaml")
sim = simmm()
mmm_input_df, channel_roi = sim.run_with_config(config=cfg)
Run by stages
Alternatively you may run each of the stages independently, which allows for easier debugging and in-run adjustments based on the results of each stage. The order of the stages is reflected below (without their inputs). Once you've run through every stage, results are available by calling the sim.final_df
object (channel ROI results are stored as sim.channel_roi
).
sim = simmm()
sim.simulate_baseline()
sim.simulate_ad_spend()
sim.simulate_media()
sim.simulate_cvr()
sim.simulate_decay_returns()
sim.calculate_conversions()
sim.consolidate_dataframe()
sim.calculate_channel_roi()
sim.finalize_output()
Run via CLI
A configuration file is required as input for this and should be passed as seen below. An output path can also be passed via -o
, however when not passed the current working directory will be used.
pysimmm -i example_config.yaml -o .
Development
Setting up a dev environment
conda create --prefix=./env python=3.11
conda activate ./env
pip install -e '.[dev]'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pysimmmulator-0.4.1.tar.gz
.
File metadata
- Download URL: pysimmmulator-0.4.1.tar.gz
- Upload date:
- Size: 67.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7de5c4870d04d0ee0d8cd9a7e9ba378af0a86037bc1eef5d09e6775935a6a769 |
|
MD5 | 3f7667f3d8d94e7e69b282e81483bcad |
|
BLAKE2b-256 | 2202236e9cd83fae61f78dca30961e356be0e5dcb63ea6c659811e3ca16bf463 |
File details
Details for the file pysimmmulator-0.4.1-py3-none-any.whl
.
File metadata
- Download URL: pysimmmulator-0.4.1-py3-none-any.whl
- Upload date:
- Size: 13.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14861b967d04b68045eb76bb009ac264174dc6268a0501949283aa6c6a04f993 |
|
MD5 | accf8191e8f9477e5661c8ee3a837eb8 |
|
BLAKE2b-256 | d468e6dbe4b5d4abce898b558f90f983c7bf5089f4ef4f40e47120ea3b27287c |