spencerbraun / anomaly_transformer_pytorch

PyTorch implementation of Anomaly Transformer: Time Series Anomaly Detection with Association Discrepancy
MIT License
222 stars 53 forks source link

Incorrect prior_association() ? #5

Open sappersapper opened 2 years ago

sappersapper commented 2 years ago

It seems the method prior_association() can not back propagate gradient to train Ws, or maybe I misunderstood? https://github.com/spencerbraun/anomaly_transformer_pytorch/blob/6d15200911260eee910a3664d70f07886c47708b/model.py#L41-L45

according to paper, is this the right way? gaussian = 1 / math.sqrt(2 * math.pi) / self.sigma * torch.exp(- 0.5 * (p / self.sigma).pow(2))

sappersapper commented 2 years ago

Does the self.sigma need to be constrained positive? How to constrain it?

DanyaXu commented 2 years ago

Yes, I found the same problem. gaussian = 1 / math.sqrt(2 math.pi) / self.sigma torch.exp(- 0.5 * (p / self.sigma).pow(2)).And I emailed the author about it.

I also encountered the same problem, did the author reply to you?