You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

draw_gm.py 1.9 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Compare gram matrices
  5. Created on Mon Sep 24 10:52:25 2018
  6. @author: ljia
  7. """
  8. import numpy as np
  9. import matplotlib.pyplot as plt
  10. N = 7
  11. egmin = [-3.425001366427846e-15,
  12. -5.513191435356332e-15,
  13. -1.1563146193980238e-15,
  14. -1.3999833987183273e-15,
  15. -5.811474553224136e-15,
  16. 2.196833029054622e-10,
  17. 0.0001002381061317695]
  18. egmin = np.abs(egmin)
  19. egmin2 = [-9.433792343294819e-15,
  20. np.NaN,
  21. -7.502900269338164e-16,
  22. -1.3999833987183273e-15,
  23. -8.73626400337456e-15,
  24. np.NaN,
  25. -4.04460628433013e-14]
  26. egmin2 = np.abs(egmin2)
  27. egmax = [142.86649135778595,
  28. 140.08307372708344,
  29. 64.31844814063015,
  30. 92.38382991977493,
  31. 160.72585558445357,
  32. 943.9175660197347,
  33. 299.17895175532897]
  34. egmax2 = [172.4203026547106,
  35. np.NaN,
  36. 65.53092059526354,
  37. 92.38382991977493,
  38. 180.374192331094,
  39. np.NaN,
  40. 529.3691973508182]
  41. fig, ax = plt.subplots()
  42. ind = np.arange(N) # the x locations for the groups
  43. width = 0.20 # the width of the bars: can also be len(x) sequence
  44. p1 = ax.bar(ind, egmin, width)
  45. p2 = ax.bar(ind, egmax, width, bottom=egmin)
  46. p3 = ax.bar(ind + width, egmin2, width)
  47. p4 = ax.bar(ind + width, egmax2, width, bottom=egmin2)
  48. ax.set_yscale('log', nonposy='clip')
  49. ax.set_xlabel('datasets')
  50. ax.set_ylabel('absolute eigen values')
  51. ax.set_title('Absolute eigen values of gram matrices on all datasets')
  52. plt.xticks(ind + width / 2, ('Acyclic', 'Alkane', 'MAO', 'PAH', 'MUTAG', 'Letter-med', 'ENZYMES'))
  53. #ax.set_yticks(np.logspace(-16, -3, num=20, base=10))
  54. ax.set_ylim(bottom=1e-15)
  55. ax.legend((p1[0], p2[0], p3[0], p4[0]), ('min1', 'max1', 'min2', 'max2'), loc='upper right')
  56. plt.savefig('check_gm/compare_eigen_values.eps', format='eps', dpi=300)
  57. plt.show()

A Python package for graph kernels, graph edit distances and graph pre-image problem.