facebookexperimental / Robyn

Robyn is an experimental, AI/ML-powered and open sourced Marketing Mix Modeling (MMM) package from Meta Marketing Science. Our mission is to democratise modeling knowledge, inspire the industry through innovation, reduce human bias in the modeling process & build a strong open source marketing science community.
https://facebookexperimental.github.io/Robyn/
MIT License
1.16k stars 346 forks source link

[feature] add allocator #1088

Closed alxlyj closed 4 weeks ago

alxlyj commented 1 month ago

Project Robyn

As titled. We are adding the necessary interfaces and implementation for allocator component. We also integrated the new addition of the allocator code to the notebook. These are also integrated and tested on a tutorial notebook.

Test Plan

Code flow sequence diagram on R side:


graph TD
    A[Start: robyn_allocator function] --> B[Process input parameters]
    B --> C[Check allocator constraints]
    C --> D[Prepare data for allocation]
    D --> E[Set up optimization problem]
    E --> F[Run optimization algorithm]

    subgraph "Optimization Loop"
        F1[Calculate objective function]
        F2[Apply constraints]
        F3[Update allocation]
    end

    F --> F1 --> F2 --> F3
    F3 -->|Not converged| F1
    F3 -->|Converged| G[Process optimization results]

    G --> H[Calculate allocation metrics]
    H --> I[Generate response curves]
    I --> J[Prepare output data]
    J --> K[Create allocation plots]
    K --> L[End: Return AllocatorCollect]

Tutorial notebook results with calibration:

Scenario 1:

image

Scenario 3:

image