You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's great we now have bfast for python.
I'm quite new in the field. I'm trying to implement the technic in a time-series with 180 dates, but I'm getting the value error that the length of the passed values is not equal to the required, after processing row 0. I've also tested the example "small-Peru" and raised the same error. I've checked that the required dependencies meet the desired versions and also reinstalled NumPy, but I keep getting the same error. Below are the errors I get.
Small Peru Example
`First date: 2003-07-14 00:00:00
Last date: 2016-09-27 00:00:00
Shape of data array: (216, 334, 334)
Processing row 0
Traceback (most recent call last):
File "C:/Users/vfota/diploma/test_bfast.py", line 63, in
model.fit(data, dates, nan_value=-32768)
File "C:\Users\vfota\diploma\venv\lib\site-packages\bfast\models.py", line 180, in fit
nan_value=nan_value)
File "C:\Users\vfota\diploma\venv\lib\site-packages\bfast\monitor\python\base.py", line 144, in fit
self.fit_single(y, dates)
File "C:\Users\vfota\diploma\venv\lib\site-packages\bfast\monitor\python\base.py", line 175, in fit_single
self.mapped_indices = self._map_indices(dates).astype(numpy.int32)
File "C:\Users\vfota\diploma\venv\lib\site-packages\bfast\monitor\python\base.py", line 299, in _map_indices
indices = numpy.argwhere(~numpy.isnan(ts)).T[0]
File "<array_function internals>", line 6, in argwhere
File "C:\Users\vfota\diploma\venv\lib\site-packages\numpy\core\numeric.py", line 584, in argwhere
return transpose(nonzero(a))
File "<array_function internals>", line 6, in nonzero
File "C:\Users\vfota\diploma\venv\lib\site-packages\numpy\core\fromnumeric.py", line 1896, in nonzero
return _wrapfunc(a, 'nonzero')
File "C:\Users\vfota\diploma\venv\lib\site-packages\numpy\core\fromnumeric.py", line 58, in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
File "C:\Users\vfota\diploma\venv\lib\site-packages\numpy\core\fromnumeric.py", line 51, in _wrapit
result = wrap(result)
File "C:\Users\vfota\diploma\venv\lib\site-packages\pandas\core\generic.py", line 1917, in array_wrap
return self._constructor(result, **d).finalize(self)
File "C:\Users\vfota\diploma\venv\lib\site-packages\pandas\core\series.py", line 292, in init
f"Length of passed values is {len(data)}, "
ValueError: Length of passed values is 1, index implies 5114.
Process finished with exit code 1
`
My Time-Series
`First date: 2000-01-21 00:00:00
Last date: 2015-12-24 00:00:00
Shape of data array: (181, 2669, 4094)
Start monitor: 2010-02-17 00:00:00
Processing row 0
Traceback (most recent call last):
File "C:/Users/vfota/diploma/bfast_euboea.py", line 71, in
nan_value=np.nan)
File "C:\Users\vfota\diploma\venv\lib\site-packages\bfast\models.py", line 180, in fit
nan_value=nan_value)
File "C:\Users\vfota\diploma\venv\lib\site-packages\bfast\monitor\python\base.py", line 144, in fit
self.fit_single(y, dates)
File "C:\Users\vfota\diploma\venv\lib\site-packages\bfast\monitor\python\base.py", line 175, in fit_single
self.mapped_indices = self._map_indices(dates).astype(numpy.int32)
File "C:\Users\vfota\diploma\venv\lib\site-packages\bfast\monitor\python\base.py", line 299, in _map_indices
indices = numpy.argwhere(~numpy.isnan(ts)).T[0]
File "<array_function internals>", line 6, in argwhere
File "C:\Users\vfota\diploma\venv\lib\site-packages\numpy\core\numeric.py", line 584, in argwhere
return transpose(nonzero(a))
File "<array_function internals>", line 6, in nonzero
File "C:\Users\vfota\diploma\venv\lib\site-packages\numpy\core\fromnumeric.py", line 1896, in nonzero
return _wrapfunc(a, 'nonzero')
File "C:\Users\vfota\diploma\venv\lib\site-packages\numpy\core\fromnumeric.py", line 58, in _wrapfunc
return _wrapit(obj, method, *args, **kwds)
File "C:\Users\vfota\diploma\venv\lib\site-packages\numpy\core\fromnumeric.py", line 51, in _wrapit
result = wrap(result)
File "C:\Users\vfota\diploma\venv\lib\site-packages\pandas\core\generic.py", line 1917, in array_wrap
return self._constructor(result, **d).finalize(self)
File "C:\Users\vfota\diploma\venv\lib\site-packages\pandas\core\series.py", line 292, in init
f"Length of passed values is {len(data)}, "
ValueError: Length of passed values is 1, index implies 5844.
Hello, I'm not entirely sure but I think I had the same problem as you. In the function map_indices, in the file base, in your case, in "C:\Users\vfota\diploma\venv\lib\site-packages\bfast\monitor\python\base.py", I changed the line "drange = pandas.date_range(start, end, freq="d")", where is "d" of day I changed for "S". But it depends on the frequency of your dates, I think.
I also ran into this, it is caused by this regression in numpy/pandas: numpy/numpy#15555
There's also a simple workaround in _map_indices:
indices = numpy.argwhere(~numpy.isnan(ts.to_numpy())).T[0]
I would recommend this, as it doesn't look like the issue will be fixed soon in numpy.
Hello,
It's great we now have bfast for python.
I'm quite new in the field. I'm trying to implement the technic in a time-series with 180 dates, but I'm getting the value error that the length of the passed values is not equal to the required, after processing row 0. I've also tested the example "small-Peru" and raised the same error. I've checked that the required dependencies meet the desired versions and also reinstalled NumPy, but I keep getting the same error. Below are the errors I get.
Small Peru Example
My Time-Series
bfast==0.5
matplotlib==3.1.3
numpy==1.19.2
pandas==1.0.0
pyopencl== 2020.2.2+cl12
pyOpenSSL== 19.0.0
scikit-learn==0.23.2
scipy==1.5.2
Sphinx==3.2.1
sphinx-bootstrap-theme==0.7.1
wget== 3.2
numpydoc==1.0.0
The text was updated successfully, but these errors were encountered: