Coder Social home page Coder Social logo

trustagi-lab / arga Goto Github PK

View Code? Open in Web Editor NEW
185.0 185.0 60.0 5.3 MB

This is a TensorFlow implementation of the Adversarially Regularized Graph Autoencoder(ARGA) model as described in our paper: Pan, S., Hu, R., Long, G., Jiang, J., Yao, L., & Zhang, C. (2018). Adversarially Regularized Graph Autoencoder for Graph Embedding, [https://www.ijcai.org/proceedings/2018/0362.pdf].

License: MIT License

Python 100.00%

arga's People

Contributors

ruiqi-hu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

arga's Issues

The clustering results are improved when adversarial module is removed

In the paper, the reported results of clustering on cora dataset are :

Cora     Acc     NMI     F1    Precision    ARI
ARGE    0.640   0.449   0.619    0.646     0.352
ARVGE   0.638   0.450   0.627    0.624     0.374

In the experiment section, ARGA is not compared with gae. When I remove the adversarial module and use simple gae(not vae), the results on cora dataset look like this:

Epoch: 0030 ACC=0.6403 f1_macro=0.6222 f1_micro=0.6403 NMI=0.4732 ADJ_RAND_SCORE=0.4154
Epoch: 0032 ACC=0.6448 f1_macro=0.6264 f1_micro=0.6448 NMI=0.4796 ADJ_RAND_SCORE=0.4211
Epoch: 0034 ACC=0.6470 f1_macro=0.6276 f1_micro=0.6470 NMI=0.4782 ADJ_RAND_SCORE=0.4256
Epoch: 0036 ACC=0.6536 f1_macro=0.6362 f1_micro=0.6536 NMI=0.4809 ADJ_RAND_SCORE=0.4264
Epoch: 0038 ACC=0.6558 f1_macro=0.6397 f1_micro=0.6558 NMI=0.4786 ADJ_RAND_SCORE=0.4245
Epoch: 0040 ACC=0.6603 f1_macro=0.6435 f1_micro=0.6603 NMI=0.4840 ADJ_RAND_SCORE=0.4305
Epoch: 0042 ACC=0.6448 f1_macro=0.6356 f1_micro=0.6448 NMI=0.4771 ADJ_RAND_SCORE=0.4081
Epoch: 0044 ACC=0.6514 f1_macro=0.6430 f1_micro=0.6514 NMI=0.4745 ADJ_RAND_SCORE=0.4051
Epoch: 0046 ACC=0.6518 f1_macro=0.6433 f1_micro=0.6518 NMI=0.4786 ADJ_RAND_SCORE=0.4088
Epoch: 0048 ACC=0.6629 f1_macro=0.6464 f1_micro=0.6629 NMI=0.4655 ADJ_RAND_SCORE=0.4236
Epoch: 0050 ACC=0.6510 f1_macro=0.6404 f1_micro=0.6510 NMI=0.4722 ADJ_RAND_SCORE=0.4075

It seems that the adversarial module doesn't help much to improve the performance?

UnicodeDecodeError @ input_data.py

Traceback (most recent call last):
File "ARGA/arga/run.py", line 18, in
runner.erun()
File "ARGA/arga/link_prediction.py", line 24, in erun
feas = format_data(self.data_name)
File "ARGA/arga/constructor.py", line 42, in format_data
adj, features, y_test, tx, ty, test_maks, true_labels = load_data(data_name)
File "ARGA/arga/input_data.py", line 24, in load_data
objects.append(pkl.load(open("data/ind.{}.{}".format(dataset, names[i]))))
File ".pyenv/versions/3.5.1/lib/python3.5/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x80 in position 0: invalid start byte

What's the purpose of Injecting noise to the hidden layer?

Hi @Ruiqi-Hu,
I see here https://github.com/Ruiqi-Hu/ARGA/blob/a970fa583d8c474b18f950da06bf91da03a647db/ARGA/arga/model.py#L67
you injected a Gaussian noise to the first layer.

  • What's the purpose of doing so?

Based on the original implementation of GAE,
https://github.com/tkipf/gae/blob/a1aecb00de894859f509f2d392135086a86946a0/gae/model.py#L55-L69
there is no noise, and

  • have you compared the results with and without the noise of ARGA with GAE?

  • Actually adding noise will affect the Gaussian prior p(z), right?

some bug in code

1 . change all_edge_idx = range(edges.shape[0]) to all_edge_idx = list(range(edges.shape[0])) in preprocessing.py
2 . change objects.append(pkl.load(open("data/ind.{}.{}".format(dataset, names[i])))) to
objects.append(pkl.load(open("data/ind.{}.{}".format(dataset, names[i]),'rb'),encoding='latin1')) in input_data.py

Multiple Graphs

Is there a way to embed multiple graphs with these models?

Or can I only use one graph at a time?
Thanks! This is amazing work!

got this error, please help!

Traceback (most recent call last):
File "/Users/linda/mywork/ARGA-master/ARGA/arga/run.py", line 18, in
runner.erun()
File "/Users/linda/mywork/ARGA-master/ARGA/arga/link_prediction.py", line 27, in erun
placeholders = get_placeholder(feas['adj'])
KeyError: 'adj'

About the use of GPU

Hi Ruiqi,
Thanks for your nice work! Does your code support running on GPU? I haven't modified it successfully.

Thank you very much!

"def ismember()" The actual function is different from the meaning of the name. why???

preprocessing.py -> def mask_test_edges(adj): -> def ismember(a, b, tol=5):

The actual function is different from the meaning of the name. why???

Actual function: is same rows (https://www.coder.work/article/2401015)
Surface name function: is member

import numpy as np

def ismember(a, b, tol=5):
  rows_close = np.all(np.round(a - b[:, None], tol) == 0, axis=-1)
  return (np.all(np.any(rows_close, axis=-1), axis=-1) and np.all(np.any(rows_close, axis=0), axis=0))

#[is same rows]
a = np.array([[ 6,  7],
              [ 2,  3],
              [ 0,  1],
              [ 4,  5],
              [ 8,  9]])
b = np.array([[ 0,  1],
              [ 2,  3],
              [ 4,  5],
              [ 6,  7],
              [ 8,  9]])
print(ismember(a, b)) 
# >> True

#[is member]
a1 = np.array([[ 0,  1]]) # shape=(1, 2)
print(ismember(a1, b)) 
# >> False # error

a2 = np.array([ 0,  1]) # shape=(2,)
print(ismember(a2, b)) 
# >> False # error

Why generator loss in vae model not plus the ae's cost

Hi, it's a nice work and thanks for sharing the code.
I have a puzzle, in arga_vae model, when you define the OptimizerVAE in optimizer.py, the generator_loss doesn't plus the auto-encoder cost
self.generator_loss = tf.reduce_mean( tf.nn.sigmoid_cross_entropy_with_logits(labels=tf.ones_like(d_fake), logits=d_fake))
rather than
self.generator_loss = tf.reduce_mean( tf.nn.sigmoid_cross_entropy_with_logits(labels=tf.ones_like(d_fake), logits=d_fake))+self.cost.
Can you please tell me the reason to do this?
Thanks a lot.

for help

How did you solve it in the end,When I use Python 37 + cuda10, tensorflow-gpu 1.14 appears / lib64/ libm.so .6: version `GLIBC_ 2.23' not found

Can NOT load dataset...

There's an error when I run the model:
<UnicodeDecodeError: 'gbk' codec can't decode byte 0x80 in position 0: illegal multibyte sequence>
This error occurs during loading dataset files in line:
objects.append(pkl.load(open("data/ind.{}.{}".format(dataset, names[i])))) #input_data.py->load_data
I can NOT load these dataset files...
".x",".y"... these files are unreadable, so I can't get the content and format. Could you give some data examples and explain each file?

Sorry...but is there something wrong with my operation?

can't solve this probelm

Traceback (most recent call last):
File "C:/Users/lily_bud/Desktop/ARGA-master/ARGA-master/ARGA/arga/run.py", line 3, in
from clustering import Clustering_Runner
File "C:\Users\lily_bud\Desktop\ARGA-master\ARGA-master\ARGA\arga\clustering.py", line 3, in
from sklearn.cluster import KMeans
File "C:\Python36\lib\site-packages\sklearn_init_.py", line 134, in
from .base import clone
File "C:\Python36\lib\site-packages\sklearn\base.py", line 12, in
from .utils.fixes import signature
File "C:\Python36\lib\site-packages\sklearn\utils_init_.py", line 7, in
from scipy.sparse import issparse
ImportError: cannot import name 'issparse'

Process finished with exit code 1

run ARGA for weighted A and X

Hi Ruiqi,
Thanks for your nice work! I tried to run ARGA on weighted adjacency matrix (A) and non-binary features (X), but it seems didn't work. Do you have any suggestions about this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.