IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an email to s dot adaszewski at gmail dot com. User accounts are meant only to report issues and/or generate pull requests. This is a purpose-specific Git hosting for ADARED projects. Thank you for your understanding!
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

44 lignes
1.2KB

  1. import scipy.sparse as sp
  2. class Batch(object):
  3. def __init__(self, adjacency_matrix):
  4. pass
  5. def get(size):
  6. pass
  7. def train_test_split(data, train_size=.8):
  8. pass
  9. class Minibatch(object):
  10. def __init__(self, data, node_type_row, node_type_column, size):
  11. self.data = data
  12. self.adjacency_matrix = data.get_adjacency_matrix(node_type_row, node_type_column)
  13. self.size = size
  14. self.order = np.random.permutation(adjacency_matrix.nnz)
  15. self.count = 0
  16. def reset(self):
  17. self.count = 0
  18. self.order = np.random.permutation(adjacency_matrix.nnz)
  19. def __iter__(self):
  20. adj_mat = self.adjacency_matrix
  21. size = self.size
  22. order = np.random.permutation(adj_mat.nnz)
  23. for i in range(0, len(order), size):
  24. row = adj_mat.row[i:i + size]
  25. col = adj_mat.col[i:i + size]
  26. data = adj_mat.data[i:i + size]
  27. adj_mat_batch = sp.coo_matrix((data, (row, col)), shape=adj_mat.shape)
  28. yield adj_mat_batch
  29. degree = self.adjacency_matrix.sum(1)
  30. def __len__(self):
  31. pass