Home

Awesome

CAN: Co-embedding Attributed Networks

This repository contains the Python&Pytorch implementation for CAN. Further details about CAN can be found in The paper:

Zaiqiao Meng, Shangsong Liang, Hongyan Bao, Xiangliang Zhang. Co-embedding Attributed Networks. (WSDM2019)

The orignal tensorflow implementation can be found in CAN.

A semi-supervised version of the CAN model implemented by Pytorch can be found in SCAN-Pytorch.

The orignal tensorflow implementation for SCAN can be found in SCAN.

Differences with tensorflow implementation

For computing the loss directly, I move part of the optimizer.py into train.py.

There is no funtion like tf.nn.weighted_cross_entropy_with_logits() in pytorch, so I implement it by myself. To avoid the overflowing issue dropped by sigmod (when computing the torch.log(torch.sigmoid(logits)) and torch.log(1 - torch.sigmoid(logits))), I clamp the logits value from -10 to 10.

def weighted_cross_entropy_with_logits(logits, targets, pos_weight):
    logits=logits.clamp(-10,10)
    return targets * -torch.log(torch.sigmoid(logits)) *pos_weight + (1 - targets) * -torch.log(1 - torch.sigmoid(logits))

Requirements

=================

Run the demo

=================

python train.py

Result

The Link prediction performance AUC&AP score :

DatasetAUCAP
BLOGCATALOG0.8200.822
CORA0.9890.988
CITESEER0.9930.989
DBLP0.9270.921
FLICKR0.8940.910
FACEBOOK0.9890.987

The Attribute inference performance AUC&AP score :

DatasetAUCAP
BLOGCATALOG0.8760.876
CORA0.9320.916
CITESEER0.9490.934
DBLP0.8990.902
FLICKR0.8560.844
FACEBOOK0.9760.973

The node classification performance Micro_F1&Macro_F1 score :

DatasetMicro_F1Macro_F1
BLOGCATALOG0.7600.755
CORA0.8690.857
CITESEER0.7430.689
FLICKR0.6340.629