WillKoehrsen / Data-Analysis

Data Science Using Python
https://medium.com/@williamkoehrsen/
MIT License
5.16k stars 3.64k forks source link

Getting "'StanModel' object has no attribute 'fit_class' error while using prophet model #10

Closed bhatiaaman closed 6 years ago

bhatiaaman commented 6 years ago

I am trying to use prophet mode on TechM stock model , model_data = techM.create_prophet_model()

I am getting error "

AttributeError Traceback (most recent call last)

in () ----> 1 model , model_data = techM.create_prophet_model() ~/AmanCode/Python/Stocker/stocker.py in create_prophet_model(self, days, resample) 447 stock_history = self.resample(stock_history) 448 --> 449 model.fit(stock_history) 450 451 # Make and predict for next year with future dataframe ~/anaconda3/lib/python3.6/site-packages/fbprophet/forecaster.py in fit(self, df, **kwargs) 834 try: 835 params = model.optimizing( --> 836 dat, init=stan_init, iter=1e4, **kwargs) 837 except RuntimeError: 838 params = model.optimizing( ~/anaconda3/lib/python3.6/site-packages/pystan/model.py in optimizing(self, data, seed, init, sample_file, algorithm, verbose, as_vector, **kwargs) 470 data = {} 471 seed = pystan.misc._check_seed(seed) --> 472 fit = self.fit_class(data, seed) 473 474 m_pars = fit._get_param_names() AttributeError: 'StanModel' object has no attribute 'fit_class'" I tried updating numpy as well as pystan , but still getting the same error ..
WillKoehrsen commented 6 years ago

That is a problem with either Prophet, numpy, or pystan. Did you try reinstalling with conda?

This thread might be helpful.

bhatiaaman commented 6 years ago

Thanks..

I uninstalled prophet and pystan and then reinstalled using pip with no-cache. It is working fine now

On Tue, Feb 6, 2018 at 10:39 PM, Will Koehrsen notifications@github.com wrote:

That is a problem with either Prophet, numpy, or pystan. Did you try reinstalling with conda?

This thread https://github.com/facebook/prophet/issues/249 might be helpful.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/WillKoehrsen/Data-Analysis/issues/10#issuecomment-363493864, or mute the thread https://github.com/notifications/unsubscribe-auth/Ab3YAvTJgDlI9lDLulLyKrrByu-9fdM2ks5tSIdegaJpZM4R6pC- .

WillKoehrsen commented 6 years ago

Good to hear. Prophet is relatively new and there are still issues with installation.