-
Notifications
You must be signed in to change notification settings - Fork 165
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
Anomaly score changes with length of the same input signal #491
Comments
Hi @dxiaos, thank you for raising this question! I suspect that the "windowing" concept of Orion/orion/primitives/tadgan.py Lines 460 to 461 in a00440c
you can specify the exact window you wish to use, e.g. To test whether the exact values would match up, I recommend isolating the function import numpy as np
from orion.primitives.tadgan import score_anomalies
X = np.random.random((2000, 50, 1))
critic_smooth_window = 50
error_smooth_window = 50
long_errors, _, _, _ = score_anomalies(X, ..,
critic_smooth_window=critic_smooth_window,
error_smooth_window=error_smooth_window
)
short_errors, _, _, _ = score_anomalies(X[50:150], ..,
critic_smooth_window=critic_smooth_window,
error_smooth_window=error_smooth_window
) |
@sarahmish Thank you for you suggestion above! I have tried set the parameters for the I have attached the implemented sample codes here:
you can try this on your environment and check the results. |
Hi @dxiaosa! Apologies for taking long to reply. I revisited the code source for Orion/orion/primitives/tadgan.py Line 505 in 4da126f
However, the general shape (peaks and valleys) should follow the same trajectory. I made a colab notebook here to help clarify the results. |
Hello, @sarahmish , Thank you for your patient check! Yeah, I had tested out your supplied colab notebook and found that if I change the comb='rec' with result plotting, there is still a little bit differences between the long and short sequence, which is shown as follows. And the 'stats.zscore()' only does the normalizing or scaling thing, if the results still have differences. I think maybe there is something with the reconstruction scores computing? Orion/orion/primitives/tadgan.py Line 502 in 4da126f
Thanks. |
That is slightly odd @dxiaosa, I imagine it has to do with whether or not the edges of the window are inclusive in the calculation. I'll investigate this a bit further and get back to you. Thank you for your patience! |
Hi @dxiaosa, apologies for the delay! I updated the notebook to fix the issues we were observing.
If you have further questions, please let me know! |
Description
When predicting anomaly score on a dataset using
score_anomalies()
function after training a TadGAN model. I find that different lengths of the series will be lead to different results. For example, if the signal X has 200 data points, the score of position 100th will be different when passing X[:] and X[500:150]. The sliding window size is set to 50 in fact.Do you have any idea about what will cause this problem possibly. I have checked the issue #288. But they could be very different.
Thanks.
The text was updated successfully, but these errors were encountered: