-
Notifications
You must be signed in to change notification settings - Fork 128
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
For OCGNN models, update hypersphere radius, and filter training data with active_mask #95
Conversation
|
Hi Ahmed, thanks a lot for your contributions. However, I have some concerns.
|
It's my pleasure to contribute, regarding your concerns.
|
Thanks for your reply. That makes sense. I am still considering whether we should add this mask for the only one class model in our library. Actually, this one class setting is very strict. The training data cannot contain any outliers. It might be too ideal for real-world applications. For the |
I am just confirming, Is there any tasks you need from my side for this pull request? |
pygod/nn/ocgnn.py
Outdated
@@ -108,17 +108,20 @@ def loss_func(self, emb): | |||
score : torch.Tensor | |||
Outlier scores of shape :math:`N` with gradients. | |||
""" | |||
if is_train: | |||
if self.warmup > 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are able to merge this part without is_train
flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we keep only the part I marked and reverse rest of them?
I kept the part you marked and reversed the rest of the changes. |
Thanks for reversing. But I still see several other files was changed, including the cache files. |
Yes it was cache files and empty spaces, It should be clean now. |
Pull Request Test Coverage Report for Build 7393446504
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks for your effort. PR Merged. |
This pull request follows the discussion, to update hypersphere radius. The modifications could be summarized as follows.
math.inf
, to update the hypersphere radius and centre in every epochis_train
flag parameter to update radius during training only.c
of the hypersphere before the first epoch, instead of initialising it by zeros. My experiments show that if the initial features are not centred around 0, the initializing by zeros affects the performance since the centre of the hypersphere starts far from the majority of data points.Moreover, It follows the discussion, to allow the use of training/ validating/ testing masks.
active_mask
variable. That will consider only the active nodes in (decision_score_, decision_function, and loss_func ).data.active_mask = data.train_mask
before training anddata.active_mask = data.test_mask
before testing.Regards,
Ahmed Aly