GithubHelp home page GithubHelp logo

wpro-ds / robyn Goto Github PK

View Code? Open in Web Editor NEW

This project forked from facebookexperimental/robyn

0.0 0.0 0.0 60.29 MB

Robyn is an experimental, automated and open-sourced Marketing Mix Modeling (MMM) code from Facebook Marketing Science. It uses various machine learning techniques (Ridge regression with cross validation, multi-objective evolutionary algorithm for hyperparameter optimisation, gradient-based optimisation for budget allocation etc.) to define media channel efficiency and effectivity, explore adstock rates and saturation curves. It's built for granular datasets with many independent variables and therefore especially suitable for digital and direct response advertisers with rich dataset.

Home Page: https://facebookexperimental.github.io/Robyn/

License: MIT License

R 92.35% Dockerfile 0.10% JavaScript 6.35% CSS 1.19%

robyn's Introduction

Robyn MMM Open Source 2.0 - a Beta Project from Facebook Marketing Science

2021-03-03

Quick start

1. Getting .R scripts

  • There are three .R script files:
    • fb_robyn.exec.R # you only need this script to execute, it calls the other 2 scripts
    • fb_robyn.func.R # this contains feature engineering, modelling functions and plotting
    • fb_robyn.optm.R # this contains the budget allocator and plotting
  • Two .csv files as sample data:
    • de_simulated_data.csv # this is our simulated data set.
    • generated_holidays.csv # this contains holidays of all countries from the library prophet. Please check if your country is included and if all holidays are included. It's also recommended to add extra events into this table, for example school holidays.
  • All files must be placed in the same folder

2. R version and libraries

  • It's highly recommended to update to R version 4.0.3 to avoid potential errors
  • Please make sure you've installed all library specified in fb_robyn.exec.R first
  • Please also install Anaconda for reticulate. Simple instruction please check fb_robyn.exec.R in the library section
  • For Windows, if you get openssl error, please see instructions here and here to install and update openssl

3. Test run with sample data

  • Please follow all instructions in fb_robyn.exec.R

  • After above steps, if you select all and run in fb_robyn.exec.R, the script should execute 20k iterations (500 iterations * 40 trials) and save some plots on your selected folder

  • An example model onepager looks like this: result

  • The final function f.budgetAllocator() might throw error "provided ModID is not within the best result". First of all, please read all instructions behind the function. Model IDs are encoded in each onepager .png name and also in the title. Also, execute model_output_collect$allSolutions will output all final model IDs. Please pick one and put it into f.budgetAllocator().

  • An example optimised model looks like this: result_optimised

Step-by-step Guide Website

Model selection with evolutionary algorithm

Using Facebook AI's open source gradient-free optimisation library Nevergrad, Robyn is able to leverage evolutionary algorithms to perform multi-objective hyperparameter optimisation and output a set of Pareto-optimal solutions. Besides NRMSE as loss function for the optimisation, Robyn also minimises on a business logic "decomposition distance", or DECOMP.RSSD that is aiming to steer the model towards more realistic decomposition results. In case of calibration, a third loss function MAPE.LIFT is added too.

The following plot demonstrates typical Pareto fronts 1-3 on NRMSE and DECOMP.RSSD: paretofront

Join the FB Robyn MMM community. Coming soon

FB Contact

See the CONTRIBUTING file for how to help out.

License

FB Robyn MMM R script is MIT licensed, as found in the LICENSE file.

robyn's People

Contributors

leonelsentana avatar gufengzhou avatar dependabot[bot] avatar watanta avatar kylescotshank avatar yangshun avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.