GithubHelp home page GithubHelp logo

relational-gcn's Introduction

Graph Convolutional Networks for relational graphs

Keras-based implementation of Relational Graph Convolutional Networks for semi-supervised node classification on (directed) relational graphs.

For reproduction of the entity classification results in our paper Modeling Relational Data with Graph Convolutional Networks (2017) [1], see instructions below.

The code for the link prediction task in [1] can be found in the following repository: https://github.com/MichSchli/RelationPrediction

Installation

python setup.py install

Dependencies

Important: keras 2.0 or higher is not supported as it breaks the Theano sparse matrix API. Tested with keras 1.2.1 and Theano 0.9.0, other versions might work as well.

  • Theano (0.9.0)
  • keras (1.2.1)
  • pandas
  • rdflib

Note: It is possible to use the TensorFlow backend of keras as well. Note that keras 1.2.1 uses the TensorFlow 0.11 API. Using TensorFlow as a backend will limit the maximum allowed size of a sparse matrix and therefore some of the experiments might throw an error.

Usage

Important: Switch keras backend to Theano and disable GPU execution (GPU memory is too limited for some of the experiments). GPU speedup for sparse operations is not that essential, so running this model on CPU will still be quite fast.

To replicate the experiments from our paper [1], first run (for AIFB):

python prepare_dataset.py -d aifb

Afterwards, train the model with:

python train.py -d aifb --bases 0 --hidden 16 --l2norm 0. --testing

Note that Theano performs an expensive compilation step the first time a computational graph is executed. This can take several minutes to complete.

For the MUTAG dataset, run:

python prepare_dataset.py -d mutag
python train.py -d mutag --bases 30 --hidden 16 --l2norm 5e-4 --testing

For BGS, run:

python prepare_dataset.py -d bgs
python train.py -d bgs --bases 40 --hidden 16 --l2norm 5e-4 --testing

For AM, run:

python prepare_dataset.py -d am
python train.py -d am --bases 40 --hidden 10 --l2norm 5e-4 --testing

Note: Results depend on random seed and will vary between re-runs.

Setting keras backend to Theano

Create a file ~/.keras/keras.json with the contents:

{
    "image_dim_ordering": "tf",
    "epsilon": 1e-07,
    "floatx": "float32",
    "backend": "theano"
}

Enforcing CPU execution

You can enforce execution on CPU by hiding all GPU resources:

CUDA_VISIBLE_DEVICES= python train.py -d aifb --bases 0 --hidden 16 --l2norm 0. --testing

References

[1] M. Schlichtkrull, T. N. Kipf, P. Bloem, R. van den Berg, I. Titov, M. Welling, Modeling Relational Data with Graph Convolutional Networks, 2017

Cite

Please cite our paper if you use this code in your own work:

@article{schlichtkrull2017modeling,
  title={Modeling Relational Data with Graph Convolutional Networks},
  author={Schlichtkrull, Michael and Kipf, Thomas N and Bloem, Peter and Berg, Rianne van den and Titov, Ivan and Welling, Max},
  journal={arXiv preprint arXiv:1703.06103},
  year={2017}
}

relational-gcn's People

Contributors

tkipf 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

relational-gcn's Issues

Memory error

Hi! I was working with relational-gcn with my dataset (X.shape = [17069, 300], num relations = 11) and I got some problems with GPU's memmory. I have two GeForce GTX 1080 Ti

InternalError: 2 root error(s) found.
  (0) Internal: Dst tensor is not initialized.
	 [[{{node _arg_input_11_0_6}}]]
	 [[loss_2/add/_147]]
  (1) Internal: Dst tensor is not initialized.
	 [[{{node _arg_input_11_0_6}}]]
0 successful operations.
0 derived errors ignored.
Stats:
Limit:                 10977044071
InUse:                  8214125056
MaxInUse:               8214411008
NumAllocs:                     130
MaxAllocSize:           1220657664

The code for setup GPUs usage

gpus = tf.config.experimental.list_physical_devices('GPU')
    if gpus:
        try:
            # Restrict TensorFlow to only use the fourth GPU
            tf.config.experimental.set_visible_devices(gpus[0], 'GPU')
            tf.config.experimental.per_process_gpu_memory_fraction=0.4

            # Currently, memory growth needs to be the same across GPUs
            for gpu in gpus:
                tf.config.experimental.set_memory_growth(gpu, True)
            logical_gpus = tf.config.experimental.list_logical_devices('GPU')
            print(len(gpus), "Physical GPUs,", len(logical_gpus), "Logical GPUs")
        except RuntimeError as e:
            # Memory growth must be set before GPUs have been initialized
            print(e)

Is it possible to vary the amount of memory when training the model?

Please, let me know if I'm doing something wrong

TypeError: Input layers to a `Model` must be `InputLayer` objects.

TypeError: Input layers to a Model must be InputLayer objects. Received inputs: [<tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705D0FD0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F704D4E80>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705127B8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70512CF8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70512C50>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705217B8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70521CF8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70521C50>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705277B8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70527CF8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70527CC0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7052E748>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7052EC50>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7052EB00>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7052EFD0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70533BA8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70533A58>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70533F28>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70539B00>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70539F28>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70539FD0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7053FA58>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7053FF60>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7053FEB8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705459B0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70545EB8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70545E10>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7054C908>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7054CE10>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7054CDD8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70553860>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70553D68>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70553D30>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705597B8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70559CC0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70559C88>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70560710>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70560C18>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70560AC8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70560F98>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70567B70>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70567BA8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70567A20>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7056DAC8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7056DF60>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7056DF98>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70572A20>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70572F28>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70572E80>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70578978>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70578E80>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70578DD8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705808D0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70580DD8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70580DA0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70586828>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70586D30>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70586CF8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7058C780>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7058CC88>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7058CB38>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F7058CC50>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70593BE0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70593A90>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70593F60>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70599B38>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F70599B70>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705999E8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705A1A90>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705A1F98>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705A1EF0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705A59E8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705A5EF0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705A5E48>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705AD940>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705ADE48>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705ADDA0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705B3898>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705B3DA0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705B3D68>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705BA7F0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705BACF8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705BACC0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705C1748>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705C1C50>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705C1B00>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705C1FD0>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705C8BA8>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705C8A58>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705C8F28>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705D0B00>, <tensorflow.python.framework.sparse_tensor.SparseTensor object at 0x0000025F705D0F28>]. Input 1 (0-based) originates from layer type InputLayerAdj.

How to save model to .h5 file ?

I used model.save() but I got the error:
Traceback (most recent call last):
File "/Applications/PyCharm CE.app/Contents/plugins/python-ce/helpers/pydev/pydevd.py", line 1477, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "/Users/liang/Downloads/mee/3_rgcn/rgcn/train.py", line 322, in
model.save('./models/1.h5')
File "/Users/liang/opt/anaconda3/envs/py2/lib/python2.7/site-packages/keras/engine/topology.py", line 2630, in save
save_model(self, filepath, overwrite)
File "/Users/liang/opt/anaconda3/envs/py2/lib/python2.7/site-packages/keras/models.py", line 56, in save_model
model.save_weights_to_hdf5_group(model_weights_group)
File "/Users/liang/opt/anaconda3/envs/py2/lib/python2.7/site-packages/keras/engine/topology.py", line 2679, in save_weights_to_hdf5_group
dtype=val.dtype)
File "/Users/liang/opt/anaconda3/envs/py2/lib/python2.7/site-packages/h5py/_hl/group.py", line 139, in create_dataset
self[name] = dset
File "/Users/liang/opt/anaconda3/envs/py2/lib/python2.7/site-packages/h5py/_hl/group.py", line 373, in setitem
h5o.link(obj.id, self.id, name, lcpl=lcpl, lapl=self._lapl)
File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
File "h5py/h5o.pyx", line 202, in h5py.h5o.link
RuntimeError: Unable to create link (name already exists)

prepare_dataset generalization

Hi, I was working with relational-gcn and I noticed that in prepare_dataset.py unnecessary rows of the adjacency matrices are zeroed to optimize the computation. However if the number of layers is greater than 2 the optimization would zero rows of nodes that are needed for the computation.

If I understood the code correctly, for the optimization to adjust based on the number of layers, the code should be updated as follows.

diff --git a/rgcn/prepare_dataset.py b/rgcn/prepare_dataset.py
index ef22e16..9c52c91 100644
--- a/rgcn/prepare_dataset.py
+++ b/rgcn/prepare_dataset.py
@@ -48,11 +48,12 @@ t = time.time()
 bfs_generator = bfs_relational(A, labeled_nodes_idx)
 lvls = list()
 lvls.append(set(labeled_nodes_idx))
-lvls.append(set.union(*bfs_generator.next()))
+for n in range(NUM_GC_LAYERS - 1):
+    lvls.append(set.union(*bfs_generator.next()))
 print("Done! Elapsed time " + str(time.time() - t))
 
 # Delete unnecessary rows in adjacencies for memory efficiency
-todel = list(set(range(num_nodes)) - set.union(lvls[0], lvls[1]))
+todel = list(set(range(num_nodes)) - set.union(*lvls))
 for i in range(len(A)):
     csr_zero_rows(A[i], todel)

Please let me know if this is correct or I am missing something.

Some questions about the details of implement

Hi,Thomas
I have two questions:

  • In train.py the variable X_in in this code model= Model(input=[X_in] + A_in, output=Y),is generated from Input(shape=(X.shape[1],), sparse=True) .And it should be viewed as the features for each nodes.But X is generated from X = sp.csr_matrix(A[0].shape),where A is got from A = data['A'].According to the definitnion of prepare_dataset.py ,A represents the adjacent matrix.Maybe I don't get the definition of sp.csr_matrix,I think X is full of zero with the shape same as A and it doesn't represent features.
  • As you said,R-GCN is primarily motivated as an extension of GCNs.So,is the spectral theory or Chebyshev polynomial basis filters applied in R-GCN?
    I'm new to this filed of research and not familiar to Keras yet,and thank you for your clarification.

TypeError: Expected int32, got <tf.Variable 'graphconvolution_1_W:0' shape=(8285, 16) dtype=float32_ref> of type 'Variable' instead.

sorry
run train.py and this is the error
Traceback (most recent call last):
File "/home/bfs/NEW_LAB/relational-gcn-master/rgcn/train.py", line 92, in
W_regularizer=l2(L2))([X_in] + A_in)
File "/home/bfs/miniconda3/envs/py27tf14_rgcn/lib/python2.7/site-packages/keras/engine/topology.py", line 548, in call
self.build(input_shapes)
File "build/bdist.linux-x86_64/egg/rgcn/layers/graph.py", line 69, in build
File "/home/bfs/miniconda3/envs/py27tf14_rgcn/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 1427, in concatenate
return tf.concat(axis, [to_dense(x) for x in tensors])
File "/home/bfs/miniconda3/envs/py27tf14_rgcn/lib/python2.7/site-packages/tensorflow/python/ops/array_ops.py", line 1096, in concat
dtype=dtypes.int32).get_shape().assert_is_compatible_with(
File "/home/bfs/miniconda3/envs/py27tf14_rgcn/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 836, in convert_to_tensor
as_ref=False)
File "/home/bfs/miniconda3/envs/py27tf14_rgcn/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 926, in internal_convert_to_tensor
ret = conversion_func(value, dtype=dtype, name=name, as_ref=as_ref)
File "/home/bfs/miniconda3/envs/py27tf14_rgcn/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 229, in _constant_tensor_conversion_function
return constant(v, dtype=dtype, name=name)
File "/home/bfs/miniconda3/envs/py27tf14_rgcn/lib/python2.7/site-packages/tensorflow/python/framework/constant_op.py", line 208, in constant
value, dtype=dtype, shape=shape, verify_shape=verify_shape))
File "/home/bfs/miniconda3/envs/py27tf14_rgcn/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 383, in make_tensor_proto
_AssertCompatible(values, dtype)
File "/home/bfs/miniconda3/envs/py27tf14_rgcn/lib/python2.7/site-packages/tensorflow/python/framework/tensor_util.py", line 303, in _AssertCompatible
(dtype.name, repr(mismatch), type(mismatch).name))
TypeError: Expected int32, got <tf.Variable 'graphconvolution_1_W:0' shape=(8285, 16) dtype=float32_ref> of type 'Variable' instead.

Process finished with exit code 1

Why is AM so small??

Hi, in the paper, there are 1,666,764 entities and 5,988,321 edges reported in the dataset of AM
image

However, in rgcn/data/am, there is only 1000 instances randomly sampled from the complete AM dataset:
image

I wonder that results of AM reported in the paper are based on the complete dataset or just the sampled set? I think this may cause very huge performance margin against reported results:
image

There is also no sampling process illustrated in the original paper:
image

Besides the results, I also wonder that whether the model can run on a large-scale dataset. Thanks!

A question about model.fit in keras

Hi, I want to extend your code to implement a binary link prediction task, the train_X is the indexes of nodes in graph with the shape of (train_size,2), each pair is like [node1_idx, node2_idx], and train_label's shape is (train_size,)

After the GraphConvolution Layer(the output is gc_output), I added a DistMult Layer to calculate the triple score e1 * R * e2, it was realized by gc_output[train_idx[:,0]] * R * gc_output[train_idx[:,1]]. The total Model(named model) consists of GraphConvolution layer and DistMult layer.

The problem I encountered was that when I fit data in Model like model.fit([X]+A, y_train), keras threw the errorValueError: Input arrays should have the same number of samples as target arrays. Found 74940 input samples and 11519 target samples. The sample_weight method used in your code seems no help for me. My friends suggested that pytorch can easily do this, but rewriting will cost more time.

I am new to keras, and I will really appreciate it if you can give me any suggestion related to this problem.

Require Keras backend and version update if possible

As Theano is no longer updated, Keras automatically uses tensorflow as backend.

Keras also has been updated to 2.2, such as some module names (example: initializations => initializers. and _inbound_nodes error).

Also, the codes still support stated version theano (0.9.0) and keras(1.2.1).It could be better to fix some minor issues to up-to-date version if possible

errors in run train.py

i changed X into X=sp.dia_matrix(A[0].shape)
it was still errors.
in fact, the version still bring many errors, e.g.
return x=x.__dims, however, there doesn't exist the attribute "__dims"๏ผŸ

work on entity alignment

does r-gcn works on entity alignment (existing R-GCN seems only focus on classification and link prediction)?

If yes, May I know do you have any working code on this?

Using node features (featureless=False in first conv-layer)

Hi @tkipf,

first of all, thank you for your work on GCNs, I'm currently researching their application in my domain and really like the results so far.

Sadly I'm stuck with a problem I'm not sure how to solve. I'm trying to apply the rgcn in the following setup: There are multiple, relatively small graphs of variable size, which contain directed edges and nodes with an optional feature vector (*). Those graphs have to be classified into 2 separate classes, which I do by introducing a global node -- the "hacky" solution you proposed in Issue #4 on the original gcn code. If I use your code in "featureless" mode, everything works pretty well and I get about 80% accuracy. I suspect that I can improve that by using the node features from above.

As soon as I change the featureless flag in the first gc-layer, the net won't learn an "estimator" anymore, but instead a constant output regardless of input (the ratio between target classes to be precise).

I did some digging to figure out where I went wrong and saw that you use the square identity matrix as dummy features in the featureless case. I then set featureless=False and passed in the square identity matrix, which resulted in roughly the same ~80% accuracy on the global node. But if I change the identity matrix to something like a matrix of the same dimensions, but with ones in the first column instead of in the diagonal, training fails again.
Did I miss an assumption you made in your paper? Are feature vectors simply not allowed and instead I have to use scalars along the diag of X?

I realize that you get a lot of questions regarding your code and work, but I'd be very grateful for any hints or ideas.

Cheers,
Julian

(*) Those optional features are latent vectors from an embedding, but sometimes there is nothing to embed. I solved that by using the zero vector in the latter case. Maybe there is a better way?

the format of the datasets

hi , could you give the description of the format of the datasets? i want to know the how to design the format of my own datasets. thanks.

Double Dropout is used

Dropout is used in GCN layer by featureless=True, then is directly applied to this output, resulting in double dropout?

Inside train.py

H = GraphConvolution(HIDDEN, support, num_bases=BASES, featureless=True,
                     activation='relu',
                     W_regularizer=l2(L2))([X_in] + A_in)
H = Dropout(DO)(H)

Inside class GraphConvolution

if self.featureless:
  tmp = K.ones(self.num_nodes)
  tmp_do = Dropout(self.dropout)(tmp)
  output = (output.T * tmp_do).T

I meet a problem when I try to run train.py

I have installed the environment, but when I run "python train.py -d aifb --bases 0 --hidden 16 --l2norm 0. --testing", the kernel would throw an error as follow:

  • TypeError: Expected int32, got <tensorflow.python.ops.variables.Variable object at 0x7f7f4b92f2d0> of type 'Variable' instead.

Can anyone help me please?

Validation loss goes to infinity

I have a large graph with 7000 nodes and 20 million triples with 110 class types and 59 relation types. Somewhere along the training, the validation loss suddenly becomes infinite. We also tried this on a much smaller graph with 7000 nodes and 117k triples with 110 class types and 10 relation types. The validation loss somehow kept increasing instead of decreasing until it went to infinity suddenly.
Any insights into what might be causing it and how to debug? Is it just an issue of the graph size or could something else be wrong?

Question about Feature dimensions

Hi, thanks for this interesting approach! I also read your paper and I still have an open question about the input features and the data set that you use.

Am I right that data sets like AIFB don't naturally have input features? In the documentation on stellargraph, it is indicated that one-hot encoded vectors are used instead. How are these one-hot encoded vectors created? Are they just indices or based on which information is the one-hot encoding made?

I also wonder whether your model takes into account that entities might be of different types (affiliations, person) and have different features so that the dimension of $h_i$ and $h_j$ might be different? And the weight matrices would not only depend on the relation type but also on the type of the node? Or am I missing something here?

Thank you :) Luisa

About the InputLayerAdj

Hi,
I have trouble running the code. It raises TypeError: Input layers to a 'Model' must be 'InputLayer' objects. Does it mean that custom the input layer is not allowed?
I'm wondering whether this is due to the keras version, or you have modified the Keras source code.

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.