Closed ppkhairn closed 2 years ago
Hi @ppkhairn ,
Just tried running the example again but I'm getting the error "RemoteDataError: No data fetched using 'YahooDailyReader'
", not sure if their API is down for now.
Maybe it's something wrong in the input data, not sure. I'll try again a bit later to see if works again.
Hi Will,
Thanks for your reply.
I got around "RemoteDataError: No data fetched using 'YahooDailyReader'" error by doing this:
import pandas from pandas_datareader import data as pdr import yfinance as yfin import datetime yfin.pdr_override()
btc_data = pdr.get_data_yahoo(['BTC-USD'], start=datetime.datetime(2018, 1, 1), end=datetime.datetime(2020, 12, 3))['Close']
I also got rid of the 'Cholesky decomposition' error by upgrading tensorflow_probability to 0.14.1 I used - pip install -U tfcausalimpact which solved the issue. I was able to reproduce your results.
Thank you and I will let you know if I have more questions.
That's good to know :)
If you find any issues please let me know.
Best,
Will
Hi Will, I got the following error while reproducing your results from the medium post.
import tensorflow_probability as tfp from causalimpact.misc import standardize
normed_data, mu_sig = standardize(data) obs_data = normed_data['BTC-USD'].loc[:'2020-10-14'].astype(np.float32) design_matrix = pd.concat(
).astype(np.float32).iloc[:, 1:] linear_level = tfp.sts.LocalLinearTrend(observed_time_series=obs_data) linear_reg = tfp.sts.LinearRegression(design_matrix=design_matrix) month_season = tfp.sts.Seasonal(num_seasons=4, num_steps_per_season=1, observed_time_series=obs_data, name='Month') year_season = tfp.sts.Seasonal(num_seasons=52, observed_time_series=obs_data, name='Year') model = tfp.sts.Sum([linear_level, linear_reg, month_season, year_season], observed_time_series=obs_data)
pre_period = ['2018-01-03', '2020-10-14'] post_period = ['2020-10-21', '2020-11-25']
ci = CausalImpact(data, pre_period, post_period, model=model)
Output:
WARNING:tensorflow:@custom_gradient grad_fn has 'variables' in signature, but no ResourceVariables were used on the forward pass. WARNING:tensorflow:@custom_gradient grad_fn has 'variables' in signature, but no ResourceVariables were used on the forward pass. WARNING:tensorflow:@custom_gradient grad_fn has 'variables' in signature, but no ResourceVariables were used on the forward pass. WARNING:tensorflow:@custom_gradient grad_fn has 'variables' in signature, but no ResourceVariables were used on the forward pass. WARNING:tensorflow:@custom_gradient grad_fn has 'variables' in signature, but no ResourceVariables were used on the forward pass. WARNING:tensorflow:@custom_gradient grad_fn has 'variables' in signature, but no ResourceVariables were used on the forward pass.
InvalidArgumentError Traceback (most recent call last)