A Pytorch implement of paper "Anomaly detection in dynamic graphs via transformer" (TADDY).

Overview

TADDY: Anomaly detection in dynamic graphs via transformer

This repo covers an reference implementation for the paper "Anomaly detection in dynamic graphs via transformer" (TADDY).

framework

Some codes are borrowed from Graph-Bert and NetWalk.

Requirments

  • Python==3.8
  • PyTorch==1.7.1
  • Transformers==3.5.1
  • Scipy==1.5.2
  • Numpy==1.19.2
  • Networkx==2.5
  • Scikit-learn==0.23.2

Usage

Step 0: Prepare Data

python 0_prepare_data.py --dataset uci

Step 1: Train Model

python 1_train.py --dataset uci --anomaly_per 0.1

Cite

If this code is helpful, please cite the original paper:

@ARTICLE{liu2021anomaly,
  author={Liu, Yixin and Pan, Shirui and Wang, Yu Guang and Xiong, Fei and Wang, Liang and Chen, Qingfeng and Lee, Vincent CS},
  journal={IEEE Transactions on Knowledge and Data Engineering}, 
  title={Anomaly Detection in Dynamic Graphs via Transformer}, 
  year={2021},
  doi={10.1109/TKDE.2021.3124061}}

Don't forget to press a "star" after using!

You might also like...
Implement Decoupled Neural Interfaces using Synthetic Gradients in Pytorch
Implement Decoupled Neural Interfaces using Synthetic Gradients in Pytorch

disclaimer: this code is modified from pytorch-tutorial Image classification with synthetic gradient in Pytorch I implement the Decoupled Neural Inter

SFD implement with pytorch
SFD implement with pytorch

S³FD: Single Shot Scale-invariant Face Detector A PyTorch Implementation of Single Shot Scale-invariant Face Detector Description Meanwhile train hand

Using pytorch to implement unet network for liver image segmentation.

Using pytorch to implement unet network for liver image segmentation.

Implement of homography net by pytorch
Implement of homography net by pytorch

HomographyNet Implement of homography net by pytorch Brief Introduction This project is based on the work Homography-Net: @article{detone2016deep, t

Implement of "Training deep neural networks via direct loss minimization" in PyTorch for 0-1 loss

This is the implementation of "Training deep neural networks via direct loss minimization" published at ICML 2016 in PyTorch. The implementation targe

Unofficial pytorch-lightning implement of Mip-NeRF
Unofficial pytorch-lightning implement of Mip-NeRF

mipnerf_pl Unofficial pytorch-lightning implement of Mip-NeRF, Here are some results generated by this repository (pre-trained models are provided bel

This repository is related to an Arabic tutorial, within the tutorial we discuss the common data structure and algorithms and their worst and best case for each, then implement the code using Python.

Data Structure and Algorithms with Python This repository is related to the Arabic tutorial here, within the tutorial we discuss the common data struc

Implement face detection, and age and gender classification, and emotion classification.
Implement face detection, and age and gender classification, and emotion classification.

YOLO Keras Face Detection Implement Face detection, and Age and Gender Classification, and Emotion Classification. (image from wider face dataset) Ove

offical implement of our Lifelong Person Re-Identification via Adaptive Knowledge Accumulation in CVPR2021
offical implement of our Lifelong Person Re-Identification via Adaptive Knowledge Accumulation in CVPR2021

LifelongReID Offical implementation of our Lifelong Person Re-Identification via Adaptive Knowledge Accumulation in CVPR2021 by Nan Pu, Wei Chen, Yu L

Comments
  • runtime error about the

    runtime error about the "data/eigen" folder

    Hi, I am running your code with the command: python 1_train.py --dataset uci --anomaly_per 0.1 after running: python 0_prepare_data.py --dataset uci And it shows that 'data/eigen/uci_0.5_0.1.pkl' not found, so I make a copy the same as which in the 'data/percent' folder. Is that correct? But actually I run into a bug with the traceback: $$$$ Start $$$$ Loading uci dataset... Loading eigen from: data/eigen/uci_0.5_0.1.pkl Traceback (most recent call last): File "1_train.py", line 56, in <module> setting_obj.run() File "/home/syj/syj_project/TADDY_pytorch/codes/Settings.py", line 8, in run loaded_data = self.dataset.load() File "/home/syj/syj_project/TADDY_pytorch/codes/DynamicDatasetLoader.py", line 173, in load adjs, eigen_adjs = self.get_adjs(rows, cols, weights, nb_nodes) File "/home/syj/syj_project/TADDY_pytorch/codes/DynamicDatasetLoader.py", line 134, in get_adjs eigen_adjs.append(np.array(eigen_adj_sparse.todense())) AttributeError: 'list' object has no attribute 'todense' And I totally have no idea why eigen_adj_sparse is a list? Could you please help me wtih this? Thanks in advance.

    PS: actually my running environment matches yours.

    opened by Switchsyj 1
  • ValueError: row index exceeds matrix dimensions

    ValueError: row index exceeds matrix dimensions

    File "C:\Users\16645\Desktop\代码\Anomaly Detection in Dynamic Graphs via\1_train.py", line 56, in setting_obj.run() File "C:\Users\16645\Desktop\代码\Anomaly Detection in Dynamic Graphs via\codes\Settings.py", line 8, in run loaded_data = self.dataset.load() File "C:\Users\16645\Desktop\代码\Anomaly Detection in Dynamic Graphs via\codes\DynamicDatasetLoader.py", line 173, in load adjs, eigen_adjs = self.get_adjs(rows, cols, weights, nb_nodes) File "C:\Users\16645\Desktop\代码\Anomaly Detection in Dynamic Graphs via\codes\DynamicDatasetLoader.py", line 142, in get_adjs adj = sp.csr_matrix((weights[i], (rows[i], cols[i])), shape=(nb_nodes, nb_nodes), dtype=np.float32) File "C:\aconda\envs\python38\lib\site-packages\scipy\sparse\compressed.py", line 54, in init other = self.class(coo_matrix(arg1, shape=shape)) File "C:\aconda\envs\python38\lib\site-packages\scipy\sparse\coo.py", line 196, in init self._check() File "C:\aconda\envs\python38\lib\site-packages\scipy\sparse\coo.py", line 283, in _check raise ValueError('row index exceeds matrix dimensions')

    opened by 1664587146 1
  • The “eigen” dataset is missing

    The “eigen” dataset is missing

    `def get_adjs(self, rows, cols, weights, nb_nodes):

        eigen_file_name = 'data/eigen/' + self.dataset_name + '_' + str(self.train_per) + '_' + str(self.anomaly_per) + '.pkl'
        if not os.path.exists(eigen_file_name):`
    

    Hello author, the above data set is missing in your code.

    opened by dawn9808 0
  • Incorporating Node/Edge features

    Incorporating Node/Edge features

    Hello,

    based on your code and paper, only topological time dependent Embeddings are generated. In the case of Network Intrusion Detection, for example, edge features are important to integrate in the embeddings. Is there a way to extend your model, so that it can also handel node/edge features?

    opened by jonnyfoka 0
Owner
Yue Tan
PhD student at UTS.
Yue Tan
Official Implement of CVPR 2021 paper “Cross-Modal Collaborative Representation Learning and a Large-Scale RGBT Benchmark for Crowd Counting”

RGBT Crowd Counting Lingbo Liu, Jiaqi Chen, Hefeng Wu, Guanbin Li, Chenglong Li, Liang Lin. "Cross-Modal Collaborative Representation Learning and a L

null 37 Dec 8, 2022
This is the official implement of paper "ActionCLIP: A New Paradigm for Action Recognition"

This is an official pytorch implementation of ActionCLIP: A New Paradigm for Video Action Recognition [arXiv] Overview Content Prerequisites Data Prep

null 268 Jan 9, 2023
This is the official implement of paper "ActionCLIP: A New Paradigm for Action Recognition"

This is an official pytorch implementation of ActionCLIP: A New Paradigm for Video Action Recognition [arXiv] Overview Content Prerequisites Data Prep

null 32 Sep 25, 2021
Unofficial implement with paper SpeakerGAN: Speaker identification with conditional generative adversarial network

Introduction This repository is about paper SpeakerGAN , and is unofficially implemented by Mingming Huang ([email protected]), Tiezheng Wang (wtz920729

null 7 Jan 3, 2023
It's a implement of this paper:Relation extraction via Multi-Level attention CNNs

Relation Classification via Multi-Level Attention CNNs It's a implement of this paper:Relation Classification via Multi-Level Attention CNNs. Training

Aybss 2 Nov 4, 2022
Third party Pytorch implement of Image Processing Transformer (Pre-Trained Image Processing Transformer arXiv:2012.00364v2)

ImageProcessingTransformer Third party Pytorch implement of Image Processing Transformer (Pre-Trained Image Processing Transformer arXiv:2012.00364v2)

null 61 Jan 1, 2023
Official pytorch implement for “Transformer-Based Source-Free Domain Adaptation”

Official implementation for TransDA Official pytorch implement for “Transformer-Based Source-Free Domain Adaptation”. Overview: Result: Prerequisites:

stanley 54 Dec 22, 2022
A Marvelous ChatBot implement using PyTorch.

PyTorch Marvelous ChatBot [Update] it's 2019 now, previously model can not catch up state-of-art now. So we just move towards the future a transformer

JinTian 223 Oct 18, 2022
a Pytorch easy re-implement of "YOLOX: Exceeding YOLO Series in 2021"

A pytorch easy re-implement of "YOLOX: Exceeding YOLO Series in 2021" 1. Notes This is a pytorch easy re-implement of "YOLOX: Exceeding YOLO Series in

null 91 Dec 26, 2022
PyTorch Implement of Context Encoders: Feature Learning by Inpainting

Context Encoders: Feature Learning by Inpainting This is the Pytorch implement of CVPR 2016 paper on Context Encoders 1) Semantic Inpainting Demo Inst

null 321 Dec 25, 2022