facebook / prophet

Tool for producing high quality forecasts for time series data that has multiple seasonality with linear or non-linear growth.
https://facebook.github.io/prophet
MIT License
18.38k stars 4.52k forks source link

forecaster.py line 161 #2173

Open JamieSeok opened 2 years ago

JamieSeok commented 2 years ago

Plz fix 'or' to '|' on the following 161 line in forecaster.py

python/lib/python3.8/site-packages/prophet/forecaster.py in validate_inputs(self) 159 raise ValueError( 160 'Parameter "growth" should be "linear", "logistic" or "flat".') --> 161 if ((self.changepoint_range < 0) or (self.changepoint_range > 1)): 162 raise ValueError('Parameter "changepoint_range" must be in [0, 1]') 163 if self.holidays is not None:

python/lib/python3.8/site-packages/pandas/core/generic.py in nonzero(self) 1440 @final 1441 def nonzero(self): -> 1442 raise ValueError( 1443 f"The truth value of a {type(self).name} is ambiguous. " 1444 "Use a.empty, a.bool(), a.item(), a.any() or a.all()."

tcuongd commented 2 years ago

Thanks! What version of pandas are you using?

winedarksea commented 2 years ago

I think this can be closed, the issue is the user was inputting a pandas series in, where the expected input is a float. but I've added another validation check to #2186 that should make for a more understandable user error.

if not isinstance(self.changepoint_range, (int, float)):
            raise ValueError("changepoint_range must be a number in [0, 1]'")