CollinRooney12 / htsprophet

Hierarchical Time Series Forecasting using Prophet
MIT License
139 stars 39 forks source link

runHTS.py does not work #6

Open XanderHorn opened 5 years ago

XanderHorn commented 5 years ago

When trying to run the example script I get the following error:

INFO:matplotlib.font_manager:font search path ['/opt/conda/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/ttf', '/opt/conda/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/afm', '/opt/conda/lib/python3.6/site-packages/matplotlib/mpl-data/fonts/pdfcorefonts'] INFO:matplotlib.font_manager:generated new fontManager

TypeError Traceback (most recent call last)

in 44 # NOTE: CVselect takes a while, so if you want results in minutes instead of half-hours pick a different method 45 ## ---> 46 myDict = hts(data2, 52, nodes, holidays = holidays, method = "FP", transform = "BoxCox") 47 ## 48 # This output is a dictionary of dataframes, so you can do any further analysis that you may want. It also allows you to plot the forecasts. /opt/conda/lib/python3.6/site-packages/htsprophet/hts.py in hts(y, h, nodes, method, freq, transform, include_history, cap, capF, changepoints, n_changepoints, yearly_seasonality, weekly_seasonality, holidays, seasonality_prior_scale, holidays_prior_scale, changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples, skipFitting, numThreads) 270 ynew = fitForecast(y, h, sumMat, nodes, method, freq, include_history, cap, capF, changepoints, n_changepoints, \ 271 yearly_seasonality, weekly_seasonality, holidays, seasonality_prior_scale, holidays_prior_scale,\ --> 272 changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples, boxcoxT, skipFitting) 273 ## 274 # Inverse boxcox the data /opt/conda/lib/python3.6/site-packages/htsprophet/fitForecast.py in fitForecast(y, h, sumMat, nodes, method, freq, include_history, cap, capF, changepoints, n_changepoints, yearly_seasonality, weekly_seasonality, holidays, seasonality_prior_scale, holidays_prior_scale, changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples, boxcoxT, skipFitting) 72 growth = 'linear' 73 m = Prophet(growth, changepoints1, n_changepoints1, yearly_seasonality, weekly_seasonality, holidays, seasonality_prior_scale, \ ---> 74 holidays_prior_scale, changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples) 75 else: 76 growth = 'logistic' /opt/conda/lib/python3.6/site-packages/fbprophet/forecaster.py in __init__(self, growth, changepoints, n_changepoints, changepoint_range, yearly_seasonality, weekly_seasonality, daily_seasonality, holidays, seasonality_mode, seasonality_prior_scale, holidays_prior_scale, changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples) 140 self.component_modes = None 141 self.train_holiday_names = None --> 142 self.validate_inputs() 143 144 def validate_inputs(self): /opt/conda/lib/python3.6/site-packages/fbprophet/forecaster.py in validate_inputs(self) 147 raise ValueError( 148 "Parameter 'growth' should be 'linear' or 'logistic'.") --> 149 if ((self.changepoint_range < 0) or (self.changepoint_range > 1)): 150 raise ValueError("Parameter 'changepoint_range' must be in [0, 1]") 151 if self.holidays is not None: TypeError: '<' not supported between instances of 'str' and 'int'
shankykm commented 5 years ago

Try the solution in this link. It worked for me.

https://stackoverflow.com/questions/48450418/hts-prophet-holidays-issue/51400527#51400527

emorfam commented 5 years ago

Open PR

7

ashish2303 commented 4 years ago

i am getting same error while running runHTS.py. "TypeError: '<' not supported between instances of 'str' and 'int'" even though i tried with keyword arguments detailed error:


TypeError Traceback (most recent call last)

in ----> 1 myDict = hts(data2, 12, nodes, method = "FP") ~\AppData\Local\Continuum\anaconda3\lib\site-packages\htsprophet\hts.py in hts(y, h, nodes, method, freq, transform, include_history, cap, capF, changepoints, n_changepoints, yearly_seasonality, weekly_seasonality, holidays, seasonality_prior_scale, holidays_prior_scale, changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples, skipFitting, numThreads) 270 ynew = fitForecast(y, h, sumMat, nodes, method, freq, include_history, cap, capF, changepoints, n_changepoints, \ 271 yearly_seasonality, weekly_seasonality, holidays, seasonality_prior_scale, holidays_prior_scale,\ --> 272 changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples, boxcoxT, skipFitting) 273 ## 274 # Inverse boxcox the data ~\AppData\Local\Continuum\anaconda3\lib\site-packages\htsprophet\fitForecast.py in fitForecast(y, h, sumMat, nodes, method, freq, include_history, cap, capF, changepoints, n_changepoints, yearly_seasonality, weekly_seasonality, holidays, seasonality_prior_scale, holidays_prior_scale, changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples, boxcoxT, skipFitting) 72 growth = 'linear' 73 m = Prophet(growth, changepoints1, n_changepoints1, yearly_seasonality, weekly_seasonality, holidays, seasonality_prior_scale, \ ---> 74 holidays_prior_scale, changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples) 75 else: 76 growth = 'logistic' ~\AppData\Local\Continuum\anaconda3\lib\site-packages\fbprophet\forecaster.py in __init__(self, growth, changepoints, n_changepoints, changepoint_range, yearly_seasonality, weekly_seasonality, daily_seasonality, holidays, seasonality_mode, seasonality_prior_scale, holidays_prior_scale, changepoint_prior_scale, mcmc_samples, interval_width, uncertainty_samples) 140 self.component_modes = None 141 self.train_holiday_names = None --> 142 self.validate_inputs() 143 144 def validate_inputs(self): ~\AppData\Local\Continuum\anaconda3\lib\site-packages\fbprophet\forecaster.py in validate_inputs(self) 147 raise ValueError( 148 "Parameter 'growth' should be 'linear' or 'logistic'.") --> 149 if ((self.changepoint_range < 0) or (self.changepoint_range > 1)): 150 raise ValueError("Parameter 'changepoint_range' must be in [0, 1]") 151 if self.holidays is not None: TypeError: '<' not supported between instances of 'str' and 'int'
eoagustin commented 3 years ago

Same. Still not working for me. Already added keyword arguments as mentioned in #7 but still getting the same error.

amd-wtruong commented 3 years ago

Hi everyone, the solution I found that worked for me was to clone the repo and delete the backslash \ characters. Not sure what \ does in python