Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 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 examples import utils
  6. from keras.layers import Dense, Activation, Dropout
  7. from keras.models import Model, Sequential
  8. from keras.regularizers import l2
  9. from keras.optimizers import Adam
  10. from keras_dgl.layers import GraphCNN
  11. import keras.backend as K
  12.  
  13. X, A, Y = utils.load_data(dataset='cora')
  14. print("Just to check that this is indeed sparse, but not zero, check the column sums: ", sum(A.A))
  15. y_train, y_val, y_test, idx_train, idx_val, idx_test, train_mask = utils.get_splits(Y)
  16. A_norm = utils.preprocess_adj_numpy(A, True)
  17.  
  18. # for reference, what do we do with preprocessing?
  19. #
  20. # adj = adj + np.eye(adj.shape[0])
  21. # d = np.diag(np.power(np.array(adj.sum(1)), -0.5).flatten(), 0)
  22. # a_norm = adj.dot(d).transpose().dot(d)
  23. # return a_norm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement