Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree.
2021-03-03
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
-
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().
- Guidelines on the website: https://facebookexperimental.github.io/Robyn/docs/step-by-step-guide
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:
Robyn MMM users Facebook Group
- [email protected], Gufeng Zhou, Marketing Science Partner
- [email protected], Leonel Sentana, Marketing Science Partner
- [email protected], Antonio Prada, Marketing Science Partner
- [email protected], Igor Skokan, Marketing Science Partner
See the CONTRIBUTING file for how to help out.
FB Robyn MMM R script is MIT licensed, as found in the LICENSE file.
- Terms of Use - https://opensource.facebook.com/legal/terms
- Privacy Policy - https://opensource.facebook.com/legal/privacy