Closed JoeyFaulkner closed 5 years ago
What is 'hat_model' ?
its the observed values which are input to the pymc3 model
https://github.com/luke14free/pm-prophet/blob/master/pmprophet/model.py#L298 these here for example
I don't understand your issue honestly (how can max get wrong?). In any case "hatmodel" should be `f'hat{self.name}'`
as an example, if you run examples/peyton_manning.ipynb
and delete the line df=df.head(180)
, then the line ddf = m.predict(60, alpha=0.2, include_history=True, plot=True)
fails
I can't reproduce this, if I remove the head part the code runs fine, what is the exact error you get @JoeyFaulkner ?
ok so, i'm running
import numpy as np
import pymc3 as pm
import pandas as pd
from pmprophet.model import PMProphet
df = pd.read_csv("example_wp_log_peyton_manning.csv")
# Fit both growth and intercept
m = PMProphet(df, growth=True, intercept=True, n_changepoints=25, changepoints_prior_scale=.01, name='model')
# Add monthly seasonality (order: 3)
m.add_seasonality(seasonality=30, fourier_order=3)
# Add weekly seasonality (order: 3)
m.add_seasonality(seasonality=7, fourier_order=3)
m.fit(method='NUTS')
ddf = m.predict(60, alpha=0.2, include_history=True, plot=True)
And in this last line, the error i get is:
ValueError Traceback (most recent call last)
<ipython-input-5-04fdbeba7386> in <module>
----> 1 ddf = m.predict(60, alpha=0.2, include_history=True, plot=True)
~/anaconda3/envs/Owl/lib/python3.7/site-packages/pmprophet/model.py in predict(self, forecasting_periods, freq, extra_data, include_history, alpha, plot)
517 additive_holidays += trace * np.repeat([m.data[holiday]], len(trace)).reshape(len(m.data), len(trace))
518
--> 519 if np.sum(multiplicative_holidays + multiplicative_seasonality + multiplicative_regressors) == 0:
520 multiplicative_term = 1
521 else:
ValueError: operands could not be broadcast together with shapes (2965,2905) (2965,2000)
my python install is 2.7, and my installed libraries (done through pip install -r requirements.txt
) are:
backports-abc==0.5
backports.functools-lru-cache==1.5
backports.shutil-get-terminal-size==1.0.0
cycler==0.10.0
decorator==4.3.2
enum34==1.1.6
futures==3.2.0
h5py==2.9.0
ipykernel==4.10.0
ipython==5.8.0
ipython-genutils==0.2.0
joblib==0.12.5
jupyter-client==5.2.4
jupyter-core==4.4.0
kiwisolver==1.0.1
matplotlib==2.2.3
numpy==1.16.2
pandas==0.24.1
pathlib2==2.3.3
patsy==0.5.1
pexpect==4.6.0
pickleshare==0.7.5
pkg-resources==0.0.0
prompt-toolkit==1.0.15
ptyprocess==0.6.0
Pygments==2.3.1
pymc3==3.6
pyparsing==2.3.1
python-dateutil==2.8.0
pytz==2018.9
pyzmq==18.0.0
scandir==1.9.0
scipy==1.2.1
simplegeneric==0.8.1
singledispatch==3.4.0.3
six==1.12.0
subprocess32==3.5.3
Theano==1.0.4
tornado==5.1.1
tqdm==4.31.1
traitlets==4.3.2
wcwidth==0.1.7
hope this makes it clearer!
This was fixed in a separate PR, closing this one. but thanks @JoeyFaulkner
when the size of the dataframe becomes too large (for example if you don't run
df = df.head(180)
in the peyton_manning.ipynb example) this max function will produce the incorrect amount of draws inpredict
. This fix gets around this problem