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.08k stars 322 forks source link

Robyn Python API - #886

Open bortackers opened 6 months ago

bortackers commented 6 months ago

Project Robyn

Issue

Following the example notebook in this repo, robyn_api/robyn_python_notebook.ipynb, I receive the following error message when I attempt to run the Multi-Objective Optimisation plots:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_16968\361802054.py in <module>
----> 1 plot_outputgraphs(OutputModels,graphtype='moo_distrb_plot',max_size=(1000, 1500),argumenttype='none')

~\MMM\Robyn\Robyn-main\robyn_api\python_helper.py in plot_outputgraphs(OutputJson, argumenttype, graphtype, max_size)
    126     """
    127     if(graphtype in ['moo_distrb_plot']):
--> 128         image_data = binascii.unhexlify("".join(OutputJson['convergence']['moo_distrb_plot']))
    129         image = Image.open(io.BytesIO(image_data))
    130         image.thumbnail(max_size, Image.Resampling.LANCZOS)

KeyError: 'convergence'

Checking the contents of OutputModels it returns ['error'], which is due to 500 - Internal server error.

Offending Code

plot_outputgraphs(OutputModels,graphtype='moo_distrb_plot',max_size=(1000, 1500),argumenttype='none')

Environment & Robyn version

ebyjose commented 6 months ago

Hi. Can I check if you ran code above this and have the object OutputModels computed? If so can you try printing the dictionary (OutputModels) and share its content. That will help us further debug

bortackers commented 6 months ago

hi @ebyjose, I ran every line up until then with no issue. When I ran the code below, it did not return an error, however, did not show the results of the response as seen in the sample workbook. I'm currently following it step-by-step to understand how it works and have made no changes at all to the code.

image
ebyjose commented 6 months ago

Thanks for your patience @bortackers and sorry for delayed response on this. Christmas and NYE time off and all. Would you be able top share the dataset or the payload used to reproduce this error?

bortackers commented 6 months ago

no problem! I'm using the sample data set included in the repo _dt_simulatedweekly

bortackers commented 5 months ago
dt_simulated_weekly = pandas_builder(robyn_api('dt_simulated_weekly'))
dt_simulated_weekly.head()
ebyjose commented 5 months ago

Unable to replicate error. It seems like the issue resides with the payload. since the object OutputModels wasnt created. Can you try sharing the payload for me to replicate the issue

sujaykar commented 4 months ago

I have installed all the R modules for Robyn and API and everything works until I am calling robyn_api to see robyn_version and call it for data loads. I was able to run the api service as detailed in the documentation. What might be the problem here?

ebyjose commented 4 months ago

@sujaykar Can you confirm which OS you are running this on? If on windows - can you share the log? If on others - can you share the exact error message you recieve?

rapidsandeepkulkarni commented 2 months ago

Automatically set these variables as 'factor_vars': 'events' Input 'window_start' is adapted to the closest date contained in input data: 2016-01-04

Running feature engineering... Input data has 208 weeks in total: 2015-11-23 to 2019-11-11 Initial model is built on rolling window of 157 week: 2016-01-04 to 2018-12-31 Time-series validation with train_size range of 50%-80% of the data... Using geometric adstocking with 20 hyperparameters (20 to iterate + 0 fixed) with no parallel computation

Starting 5 trials with 2000 iterations each using TwoPointsDE nevergrad algorithm... Running trial 1 of 5 | | 0%Timing stopped at: 0.004 0 0.005 <simpleError in signif(nevergrad_hp_val[[co]][index], 10): non-numeric argument to mathematical function>

Hi @ebyjose , please find the error log in the backend. OS Ubuntu 20.04