Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More user friendly reminder of data gap #586

Closed
iharshulhan opened this issue Sep 15, 2021 · 6 comments · Fixed by #639
Closed

More user friendly reminder of data gap #586

iharshulhan opened this issue Sep 15, 2021 · 6 comments · Fixed by #639
Labels
bug Something isn't working

Comments

@iharshulhan
Copy link

Describe the bug
Following error occures while fitting some KTR models:
ValueError: matmul: Input operand 1 has a mismatch in its core dimension 0, with gufunc signature (n?,k),(k,m?)->(n?,m?) (size 3 is different from 4)

Stacktrace:

    dlt_reg.fit(df=df, point_method='mean')
File "/opt/conda/envs/lib/python3.7/site-packages/orbit/forecaster/svi.py", line 25, in fit
    super().fit(df)
File "/opt/conda/envs/lib/python3.7/site-packages/orbit/forecaster/forecaster.py", line 128, in fit
    self._model.set_dynamic_attributes(df=df, training_meta=self.get_training_meta())
File "/opt/conda/envs/lib/python3.7/site-packages/orbit/template/ktr.py", line 798, in set_dynamic_attributes
    self._set_levs_and_seas(df, training_meta)
File "/opt/conda/envs/lib/python3.7/site-packages/orbit/template/ktr.py", line 768, in _set_levs_and_seas
    self._seasonality_fs_order)
File "/opt/conda/envs/lib/python3.7/site-packages/orbit/template/ktr.py", line 682, in _generate_seas
    seas_coef = np.squeeze(np.matmul(coef_knot, coef_kernel.transpose(1, 0)), axis=0).transpose(1, 0)

Environment (please complete the following information):

  • OS: Ubuntu
  • Python Version: 3.7
  • orbit-ml==1.1.0dev
@iharshulhan iharshulhan added the bug Something isn't working label Sep 15, 2021
@wangzhishi
Copy link
Contributor

wangzhishi commented Sep 16, 2021

hi @iharshulhan, thanks for raising this bug. do you have a minimal example (e.g., what is your model config) with data to reproduce this bug? If so, I can look into it. otherwise, it is hard for us to identify what is the problem.

@iharshulhan
Copy link
Author

Yes, the problem occurs when dates between samples are not even. I've attached a sample to reproduce the error.
sample.zip

from orbit.models import KTR

model = KTR(seasonality=[12])
model.fit(df)

@wangzhishi
Copy link
Contributor

yea, that is the root cause of the error. we expect the dates to be on the same frequency.

the date gaps in your data vary a lot. sometimes daily, sometimes weekly, or even several months gap. In this case, how to claim the seasonality and expect the model to capture it?

@iharshulhan
Copy link
Author

First of all, If there is such expectation, it would be great to state it somewhere and introduce proper warnings/errors to handle the data. Right now matmul error is not very informative.

Secondly, this expectation would significantly limit the usage of the tool with real world data. The date gaps is a problem of missing data points, we may fit the seasonality term on available points and interpolate in between. In the specific example the problem appears only with last 15 points, where there is a gap of several months.

@edwinnglabs
Copy link
Collaborator

@iharshulhan Try to clarify this, KTR does come up with a nice property to skip missing values as long as user code that observation up as a null entry. So my guess is we can have a general module to detect all the gaps with some assumption of the observations frequency and fill a null values there. Then from there, KTR should be able to pick up the work. Hope that makes sense.

@edwinnglabs edwinnglabs changed the title Matmul error More user friendly reminder of data gap Nov 24, 2021
@edwinnglabs
Copy link
Collaborator

Redefine the scope of this as making a more user friendly message when user accidentally input a dataset with gaps (inconsistent gaps).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants