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!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
954B

  1. from triacontagon.data import Data
  2. from triacontagon.sampling import negative_sample_adj_mat, \
  3. negative_sample_data
  4. from triacontagon.decode import dedicom_decoder
  5. import torch
  6. def test_negative_sample_adj_mat_01():
  7. adj_mat = torch.tensor([
  8. [0, 1, 0, 1, 0],
  9. [0, 0, 0, 0, 1],
  10. [1, 1, 0, 0, 0],
  11. [0, 0, 1, 0, 1],
  12. [0, 1, 0, 0, 0]
  13. ])
  14. print('adj_mat:', adj_mat)
  15. adj_mat_neg = negative_sample_adj_mat(adj_mat)
  16. print('adj_mat_neg:', adj_mat_neg.to_dense())
  17. def test_negative_sample_data_01():
  18. d = Data()
  19. d.add_vertex_type('Gene', 5)
  20. d.add_edge_type('Gene-Gene', 0, 0, [
  21. torch.tensor([
  22. [0, 1, 0, 1, 0],
  23. [0, 0, 0, 0, 1],
  24. [1, 1, 0, 0, 0],
  25. [0, 0, 1, 0, 1],
  26. [0, 1, 0, 0, 0]
  27. ], dtype=torch.float).to_sparse()
  28. ], dedicom_decoder)
  29. d_neg = negative_sample_data(d)