PyTorch implementation of the paper "SAD: Semi-Supervised Anomaly Detection on Dynamic Graphs".
- torch==1.10.1+cu111
- torchvision==0.9.1+cu111
- torch-geometric==2.0.4
- torch-scatter==2.0.9
- torch-sparse==0.6.12
- scikit-learn==0.23.2
Download data.csv into file './dataset/'
We use the data processing method of the reference TGAT, repo.
We use then dense npy format to save the features in binary format. If edge features or nodes features are absent, it will replaced by a vector of zeros. (While preprocess mooc data, rand_feat = np.zeros((max_idx + 1, 172))
, 172
need change to 4
)
python build_dataset_graph.py --data wikipedia --bipartite
python build_dataset_graph.py --data reddit --bipartite
python build_dataset_graph.py --data mooc --bipartite
Training the SAD Graph network based on all black samples.
python train.py --data_set wikipedia --anomaly_alpha 1e-1 --supc_alpha 5e-3
Training the SAD Graph network based on half of black samples.
python train.py --data_set wikipedia --anomaly_alpha 1e-1 --supc_alpha 5e-3 --mask_label --mask_ratio 0.5