danielenricocahall / One-Class-NeuralNetwork

Simplified implementation of one class neural network for nonlinear anomaly detection.
MIT License
46 stars 4 forks source link

all data got the same scores with too much training epochs #12

Open YingxiaoKong opened 2 years ago

YingxiaoKong commented 2 years ago

Hello Daniel,

Thank you for sharing your code. I tested it on a very simple dataset. The normal data are generated from a gaussian distribution with mean as 0 and std as 1 and the sample size is 1000. The anomalous data are generated from a gaussian distribution with mean as 5 and std as 1 and the sample is 20. I tried different epochs and the results are shown in the figure: oc_nn_score_epochs_hidden_unit_100

The hidden layer has 100 units. From the figure you can see that all the data got the same anomalous score for number of epochs as 500 and 1000. Did you notice a similar issue when you running the code?

danielenricocahall commented 2 years ago

@YingxiaoKong Hello! I think this means the model has converged - is the "anomaly score" the training loss or r? And what did you set r to?

YingxiaoKong commented 2 years ago

I don't think so... As there there indeed exists anomalous points in the data. And when I use OCSVM, the result will always be the same and it could correctly identify the anomalous points. I guess this is a nature of neural network that eventually all will be considered as normal?

danielenricocahall commented 2 years ago

Hello @YingxiaoKong - I've made some adjustments to the implementation after noticing some bugs. If you're itnerested in trying again, I would invite the feedback.