pyod icon indicating copy to clipboard operation
pyod copied to clipboard

AutoEncoder does not generate a symmetric model

Open whyisyoung opened this issue 5 years ago • 3 comments

Hi,

I plotted the model when printing the model summary: https://github.com/yzhao062/pyod/blob/da68f50ee79bd74777d2d406cac6dcfad412e599/pyod/models/auto_encoder.py#L187

And it seems that you added an extra layer at the beginning with the same dimension as the input. I don't know why this is required because it would generate an asymmetric model. Here is the model I printed out:

model

The final dimension would be like 645-645-100-100-500-9-500-100-100-645.

I think the problem might be caused by this line: https://github.com/yzhao062/pyod/blob/da68f50ee79bd74777d2d406cac6dcfad412e599/pyod/models/auto_encoder.py#L224

The performance is similar after I commented out the above line.

Please correct me if I miss something! Thanks!

whyisyoung avatar Nov 03 '19 16:11 whyisyoung

Hi there,

Thanks for reporting this issue. I thought I manually added that layer for symmetry purposes but may be redundant (or even detrimental). I know autoencoders are totally fine to be asymmetric and as you said "the difference is minor". I will double check to see whether this layer should be removed.

If sure, you are also welcome to submit a PR to the dev branch for fix this. Thanks,

Yue

yzhao062 avatar Nov 04 '19 19:11 yzhao062

Thanks for the feedback, Yue! I also noticed that the reconstructed data is not similar to the original data. I'll double check this ASAP.

whyisyoung avatar Nov 05 '19 19:11 whyisyoung

I noticed this as well. Would appreciate a fix!

kennysong avatar Dec 02 '20 08:12 kennysong