Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. import os, sys
  2. sys.path.append(os.path.join(os.getcwd(), "keras-deep-graph-learning")) # Adding the submodule to the module search path
  3. sys.path.append(os.path.join(os.getcwd(), "keras-deep-graph-learning/examples")) # Adding the submodule to the module search path
  4. import numpy as np
  5. from keras.layers import Dense, Activation, Dropout
  6. from keras.models import Model, Sequential
  7. from keras.regularizers import l2
  8. from keras.optimizers import Adam
  9. from keras_dgl.layers import GraphCNN
  10. import keras.backend as K
  11. from keras.utils import to_categorical
  12.  
  13. print("Creating our simple sample data...")
  14. A = np.array([[0,1,5], [1,0,0], [5,0,0]])
  15. print(A)
  16. X = np.array([[1,2,10], [4,3,10], [0,2,11]]) # features, whatever we have there...
  17.  
  18. # Notice, if we set A = identity matrix, then we'd effectively assume no edges and just do a basic
  19. # MLP on the features.
  20.  
  21. # We could do the same by setting the graph_conv_filter below to Id.
  22.  
  23. # We could also set X to Id, and thus effectively assume no features, and in this way
  24. # do an "edge" embedding, so effectively try to understand what's connected to what.
  25.  
  26. # We could then use that as feature in any way we like...
  27.  
  28. Y_o_dim = np.array([1,2,1])
  29. Y = to_categorical(Y_o_dim) # labels, whatever we wanna classify things into... in categorical form.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement