limaosen0 / gxn Goto Github PK
View Code? Open in Web Editor NEWGraph Cross Network
License: MIT License
Graph Cross Network
License: MIT License
Hi,
In equation (2) page 4 https://arxiv.org/pdf/2010.01804.pdf it is mentioned that we can vary R parameter to consider higher order neighboring systems. However, in the code l didn't find where do you use Rhop parametrer. The following functions are parameterized with R which is not used. How can l incorporate R ? I have missed something ?
Thank you for your consideration and for this nice work !
In the function IndexSelect()
Line 249 in cb01e49
and in the Discriminator()
Line 120 in cb01e49
Hi:
I use your published code for this paper without any change, why can't I reproduce some dataset result, such as PROTEINS, MUTAG. There occurs overfitting question in training these datasets.
I think your code actually reports the validation result right? More specifically, in here
for epoch in range(cmd_args.num_epochs):
random.shuffle(train_idxes)
classifier.train()
avg_loss = loop_dataset(train_graphs, classifier, mi_loss, train_idxes, epoch, optimizer=optimizer, device=device)
avg_loss[4] = 0.0
print('\033[92maverage training of epoch %d: clsloss: %.5f miloss: %.5f loss %.5f acc %.5f auc %.5f\033[0m'
% (epoch, avg_loss[0], avg_loss[1], avg_loss[2], avg_loss[3], avg_loss[4])) # noqa
classifier.eval()
test_loss = loop_dataset(test_graphs, classifier, mi_loss, list(range(len(test_graphs))), epoch, device=device)
test_loss[4] = 0.0
print('\033[93maverage test of epoch %d: clsloss: %.5f miloss: %.5f loss %.5f acc %.5f auc %.5f\033[0m'
% (epoch, test_loss[0], test_loss[1], test_loss[2], test_loss[3], test_loss[4])) # noqa
with open(logfile, 'a+') as log:
log.write('test of epoch %d: clsloss: %.5f miloss: %.5f loss %.5f acc %.5f auc %.5f'
% (epoch, test_loss[0], test_loss[1], test_loss[2], test_loss[3], test_loss[4]) + '\n')
if test_loss[3] > max_acc:
max_acc = test_loss[3]
fname = './checkpoint_%s/time_%s/FOLD%s/model_epoch%s.pt' % (cmd_args.data, first_timstr, foldidx, str(epoch))
torch.save(classifier.state_dict(), fname)
with open('./result_%s/result_%s/acc_result_%s_%s.txt' % (cmd_args.data, first_timstr, cmd_args.data, first_timstr), 'a+') as f:
f.write('\n')
f.write('Fold index: ' + str(foldidx) + '\t')
f.write(str(max_acc) + '\n')
Hi, in your paper you say 'In the loss function L, α decays from 2 to 0 during training, where the VIPool needs fast convergence for vertex selection'. However, in your code, the α actually decays from 2 to 1, see here.
Hi,
Your work is very impressive! Could you please provide the codes of GXN for vertex classification? Thanks!
Hi, your GXN work is interesting and I'm trying to implement it using DGL. However, I find something strange in your code.
Specifically, in your paper, the criterion function for VIPool involves two function values: T_w(\mathbf{x}_v, \mathbf{y}_{\mathcal{N}_v})
and T_w(\mathbf{x}_v, \mathbf{y}_{\mathcal{N}_u})
, where T_w(\mathbf{x}_v, \mathbf{y}_{\mathcal{N}_u}) = \mathcal{S}_w(\mathcal{E}_w(\mathbf{x}_v), \mathcal{P}_w(\mathbf{y}_{\mathcal{N}_u}))
. And as described in your paper, \mathcal{E}
is MLP, \mathcal{P}
is some Message-Passing layer.
However, in your code, it seems like you implement these in the form of T_w(\mathbf{y}_{\mathcal{N}_v}, \mathbf{x}_v)
and T_w(\mathbf{y}_{\mathcal{N}_u}, \mathbf{x}_v)
. More specifically, in the class IndexSelect
of your code:
class IndexSelect(nn.Module):
def __init__(self, k, n_h, act, R=1):
super().__init__()
self.k = k
self.R = R
self.sigm = nn.Sigmoid()
self.fc = MLP(n_h, n_h, act)
self.disc = Discriminator(n_h)
self.gcn1 = GCN(n_h, n_h)
def forward(self, seq1, seq2, A, samp_bias1=None, samp_bias2=None):
h_1 = self.fc(seq1)
h_2 = self.fc(seq2)
h_n1 = self.gcn1(A, h_1)
X = self.sigm(h_n1)
ret, ret_true = self.disc(X, h_1, h_2, samp_bias1, samp_bias2)
scores = self.sigm(ret_true).squeeze()
num_nodes = A.shape[0]
values, idx = torch.topk(scores, int(num_nodes))
values1, idx1 = values[:int(self.k*num_nodes)], idx[:int(self.k*num_nodes)]
values0, idx0 = values[int(self.k*num_nodes):], idx[int(self.k*num_nodes):]
return ret, values1, idx1, idx0, h_n1
Looks like only X
is the output of GCN, while h_1
and h_2
(In my understanding, they represent for \mathcal{P}_w(\mathbf{y}_{\mathcal{N}_v})
and \mathcal{P}_w(\mathbf{y}_{\mathcal{N}_u})
respectively) are output of MLP. If we follow the setting in your paper, shouldn't h_1
and h_2
be the output of GCN?
Hi,
Your work is really impressive! I have a question about baseline methods. Do you implement them by yourself or use the public code? To my knowledge, different baseline methods use different GCN module. If you implement them by yourself, could you please share your implementation? Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.