Skip to content

Commit

Permalink
update reference and test
Browse files Browse the repository at this point in the history
  • Loading branch information
YingtongDou committed Dec 19, 2023
1 parent 4da2a26 commit 4db367c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
3 changes: 3 additions & 0 deletions README.rst
Expand Up @@ -181,6 +181,7 @@ OCGNN 2021 GNN+AE Yes [#Wang2021One]_
CoLA 2021 GNN+AE+SSL Yes [#Liu2021Anomaly]_
GUIDE 2021 GNN+AE Yes [#Yuan2021Higher]_
CONAD 2022 GNN+AE+SSL Yes [#Xu2022Contrastive]_
GADNR 2023 GNN+AE Yes [#Roy2023Gadnr]_
================== ===== =========== =========== ========================================


Expand Down Expand Up @@ -256,3 +257,5 @@ Reference
.. [#Yuan2021Higher] Yuan, X., Zhou, N., Yu, S., Huang, H., Chen, Z. and Xia, F., 2021, December. Higher-order Structure Based Anomaly Detection on Attributed Networks. In 2021 IEEE International Conference on Big Data (Big Data).
.. [#Xu2022Contrastive] Xu, Z., Huang, X., Zhao, Y., Dong, Y., and Li, J., 2022. Contrastive Attributed Network Anomaly Detection with Data Augmentation. In Proceedings of the 26th Pacific-Asia Conference on Knowledge Discovery and Data Mining (PAKDD).
.. [#Roy2023Gadnr] Roy, A., Shu, J., Li, J., Yang, C., Elshocht, O., Smeets, J. and Li, P., 2023. GAD-NR: Graph Anomaly Detection via Neighborhood Reconstruction. In Proceedings of the 17th ACM International Conference on Web Search and Data Mining (WSDM).
1 change: 1 addition & 0 deletions docs/index.rst
Expand Up @@ -104,6 +104,7 @@ OCGNN 2021 GNN+AE Yes :class:`pygod.detector.OCGN
CoLA 2021 GNN+AE+SSL Yes :class:`pygod.detector.CoLA`
GUIDE 2021 GNN+AE Yes :class:`pygod.detector.GUIDE`
CONAD 2022 GNN+AE+SSL Yes :class:`pygod.detector.CONAD`
GADNR 2023 GNN+AE Yes :class:`pygod.detector.GADNR`
================== ===== =========== =========== ==============================================


Expand Down
7 changes: 7 additions & 0 deletions docs/zreferences.bib
Expand Up @@ -171,4 +171,11 @@ @article{kipf2016variational
author={Kipf, Thomas N and Welling, Max},
journal={arXiv preprint arXiv:1611.07308},
year={2016}
}

@inproceedings{roy2023gadnr,
title = {GAD-NR : Graph Anomaly Detection via Neighborhood Reconstruction},
author = {Roy, Amit and Shu, Juan and Li, Jia and Yang, Carl and Elshocht, Olivier and Smeets, Jeroen and Li, Pan},
booktitle={Proceedings of the 17th ACM International Conference on Web Search and Data Mining},
year = {2024}
}
15 changes: 4 additions & 11 deletions pygod/test/test_gadnr.py
Expand Up @@ -2,11 +2,10 @@
import os
import unittest
from numpy.testing import assert_equal
from numpy.testing import assert_warns
from numpy.testing import assert_raises

import torch
from torch_geometric.nn import GIN, GCN
from torch_geometric.nn import GCN
from torch_geometric.seed import seed_everything

from pygod.metric import eval_roc_auc
Expand Down Expand Up @@ -83,12 +82,11 @@ def test_sample(self):
num_neigh=1,
contamination=0.2,
verbose=3,
save_emb=True,
act_first=True)
save_emb=True)
detector.fit(self.train_data)

score = detector.predict(return_pred=False, return_score=True)
# TODO: assert (eval_roc_auc(self.train_data.y, score) >= self.roc_floor)
assert (eval_roc_auc(self.train_data.y, score) >= self.roc_floor)

pred, score, conf, emb = detector.predict(self.test_data,
return_pred=True,
Expand All @@ -97,7 +95,7 @@ def test_sample(self):
return_emb=True)

assert_equal(pred.shape[0], self.test_data.y.shape[0])
# TODO: assert (eval_roc_auc(self.test_data.y, score) >= self.roc_floor)
assert (eval_roc_auc(self.test_data.y, score) >= self.roc_floor)
assert_equal(conf.shape[0], self.test_data.y.shape[0])
assert (conf.min() >= 0)
assert (conf.max() <= 1)
Expand All @@ -124,8 +122,3 @@ def test_sample(self):
detector.predict(self.test_data,
return_prob=True,
prob_method='something')

def test_params(self):
with assert_warns(UserWarning):
detector = GADNR(num_neigh=1, backbone=GIN)
detector.fit(self.test_data)

0 comments on commit 4db367c

Please sign in to comment.