Comments (10)
I am facing the same error while using this code on Google Colab:
plot.plot_media_channel_posteriors(media_mix_model=mmm,
channel_names=media_cols)
Getting the below error:
**AttributeError Traceback (most recent call last)
in <cell line: 2>()
1 # posterior distributions of the media effects.
----> 2 plot.plot_media_channel_posteriors(media_mix_model=mmm,
3 channel_names=media_cols)
AttributeError: 'Figure' object has no attribute 'plot_media_channel_posteriors'**
I have already tried this as well but no resolve:
!pip uninstall -y matplotlib
!pip install matplotlib==3.1.3
This command: !pip install --upgrade git+https://github.com/google/lightweight_mmm.git
is by default installing matplotlib 3.6.1 and giving below error:
\ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
bigframes 1.0.0 requires matplotlib>=3.7.1, but you have matplotlib 3.6.1 which is incompatible.
Successfully installed matplotlib-3.6.1
WARNING: The following packages were previously imported in this runtime:
[matplotlib,mpl_toolkits]
You must restart the runtime in order to use newly installed versions.
So again did this:
!python -m pip uninstall matplotlib
!pip install matplotlib==3.7.1 and again used this code: plot.plot_media_channel_posteriors(media_mix_model=mmm,
channel_names=media_cols) and got the same error below:
**AttributeError Traceback (most recent call last)
in <cell line: 2>()
1 # posterior distributions of the media effects.
----> 2 plot.plot_media_channel_posteriors(media_mix_model=mmm,
3 channel_names=media_cols)
AttributeError: 'Figure' object has no attribute 'plot_media_channel_posteriors'**
Only thing different I have done is I have used: from prophet import Prophet in order to decompose weekly sales with ds and holidys data and added trend, season, holiday under extra features in control variables. Rest I am following steps under: https://github.com/google/lightweight_mmm#introduction
Please let me know if anyone able to resolve this.
from lightweight_mmm.
Hello @chsheth !
Looks like a problem with the arviz library. What version of arviz are you currently using and what python version?
from lightweight_mmm.
On the GCP instance, Python is 3.7.8 and arviz is 0.11.2.
from lightweight_mmm.
Hi @pabloduque0 -- not sure if you had any other suggestions but I was getting this error today on colab while running the end_to_end_demo_with_multiple notebook --
ImportError: cannot import name '_png' from 'matplotlib' (/usr/local/lib/python3.7/dist-packages/matplotlib/__init__.py)
Any suggestions? Thanks.
from lightweight_mmm.
Hello @chsheth !
I am unable to reproduce your error on a GCP instance with python 3.7 and the same arviz version.
Could you try pip install --upgrade git+https://github.com/google/lightweight_mmm.git
? Just in case some version got hanged or similar.
As per your other error, if its in colab could you please provide a reproducible colab for me to take a look?
Thanks!
from lightweight_mmm.
Thank you @pabloduque0.
For GCP/arviz, I can email you the notebook, cannot add it here -- I do think it has to do with some versioning.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-4-9a43dbab01ab> in <module>
1 # Import the relevant modules of the library
----> 2 from lightweight_mmm import lightweight_mmm
3 from lightweight_mmm import optimize_media
4 from lightweight_mmm import plot
5 from lightweight_mmm import preprocessing
/opt/conda/lib/python3.7/site-packages/lightweight_mmm/lightweight_mmm.py in <module>
51 from lightweight_mmm import models
52 from lightweight_mmm import preprocessing
---> 53 from lightweight_mmm import utils
54
55 Prior = Union[
/opt/conda/lib/python3.7/site-packages/lightweight_mmm/utils.py in <module>
22 import jax.numpy as jnp
23 import numpy as np
---> 24 import pandas as pd
25 from scipy import interpolate
26 from scipy import optimize
/opt/conda/lib/python3.7/site-packages/pandas/__init__.py in <module>
140 from pandas.util._print_versions import show_versions
141
--> 142 from pandas.io.api import (
143 # excel
144 ExcelFile,
/opt/conda/lib/python3.7/site-packages/pandas/io/api.py in <module>
6
7 from pandas.io.clipboards import read_clipboard
----> 8 from pandas.io.excel import ExcelFile, ExcelWriter, read_excel
9 from pandas.io.feather_format import read_feather
10 from pandas.io.gbq import read_gbq
/opt/conda/lib/python3.7/site-packages/pandas/io/excel/__init__.py in <module>
----> 1 from pandas.io.excel._base import ExcelFile, ExcelWriter, read_excel
2 from pandas.io.excel._odswriter import _ODSWriter
3 from pandas.io.excel._openpyxl import _OpenpyxlWriter
4 from pandas.io.excel._util import register_writer
5 from pandas.io.excel._xlsxwriter import _XlsxWriter
/opt/conda/lib/python3.7/site-packages/pandas/io/excel/_base.py in <module>
30 get_writer,
31 )
---> 32 from pandas.io.parsers import TextParser
33
34 _read_excel_doc = (
/opt/conda/lib/python3.7/site-packages/pandas/io/parsers/__init__.py in <module>
----> 1 from pandas.io.parsers.readers import (
2 TextFileReader,
3 TextParser,
4 read_csv,
5 read_fwf,
/opt/conda/lib/python3.7/site-packages/pandas/io/parsers/readers.py in <module>
15 import pandas._libs.lib as lib
16 from pandas._libs.parsers import STR_NA_VALUES
---> 17 from pandas._typing import (
18 ArrayLike,
19 DtypeArg,
ImportError: cannot import name 'DtypeArg' from 'pandas._typing' (/opt/conda/lib/python3.7/site-packages/pandas/_typing.py)
For '_png' from 'matplotlib' error, I found on stackoverflow that I would need to downgrade matplotlib version
!python -m pip uninstall matplotlib
!pip install matplotlib==3.1.3
I ran the above before any plot functions and there were no errors.
from lightweight_mmm.
Glad to hear the other error was solved.
Is the arviz error persisting or has that one been solved as well?
In the repro I dont need to see the data or your specific code, you can use mock data for providing the error as the error looks unrelated to your data. You can create a new notebook/colab.
from lightweight_mmm.
Actually I dont know about arviz error, if it got fixed -- the code didnt get to that cell and errored out much earlier. I am running the demo notebooks from here on my GCP instance, so there is nothing that I cannot share...
I was thinking of creating an environment, use requirements from here and then run -- maybe that might make the version issue (if there is one) go away.
from lightweight_mmm.
If you can provide me the basic specifications of your instance I can try to re-create from my side.
from lightweight_mmm.
Here are the details. Thanks for your help @pabloduque0
from lightweight_mmm.
Related Issues (20)
- How can I run kind of gridsearch to find the best custom priors for a hill_adstock or carryover model ?
- How can I input future media_data_test for optimization in upcoming periods? HOT 1
- How can channel-wise optimized conversions be obtained?
- Extra features
- Addressing Heteroscedasticity
- Geo level attribution and response curves
- Budget Allocation Percentage breakdown by channel HOT 10
- Question on tensorflow requirement
- Dtype object is not a valid JAX array type. Only arrays of numeric types are supported by JAX. HOT 5
- Same pre-optimization and post-optimization channel budget allocation ratios , but suggesting much higher budget instead of aligning the budget to the one i requested. HOT 10
- Paid Search bias - Nested model
- Divergences and n_eff
- Outliers and influential points
- budget allocator: How to set up lower bound and upper bound per channel?
- add got incompatible shapes for broadcasting: (95,), (90,). HOT 5
- TypeError: add got incompatible shapes for broadcasting: (58,), (54,). HOT 8
- Rendering of several plots not working! HOT 1
- Negative Values in Pre optimization predicted Target vs Post optimization predicted Target
- Budget Optimization
- RuntimeError: Cannot find valid initial parameters. Please check your model again.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightweight_mmm.