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_running_time.py 1.7 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3. """
  4. Draw running time.
  5. Created on Mon Sep 24 17:37:26 2018
  6. @author: ljia
  7. """
  8. import numpy as np
  9. import matplotlib.pyplot as plt
  10. N = 6
  11. tgm1 = [3.68,
  12. 2.24,
  13. 3.34,
  14. # 0,
  15. 20.00,
  16. 2020.46,
  17. 3198.84]
  18. tgm2 = [4.29,
  19. 3.35,
  20. 5.78,
  21. # 11.21,
  22. 40.58,
  23. 3136.26,
  24. 17222.21]
  25. tms1 = [51.19,
  26. 73.09,
  27. 5.01,
  28. # 0,
  29. 22.87,
  30. 2211.97,
  31. 3211.58]
  32. tms2 = [65.16,
  33. 53.02,
  34. 10.32,
  35. # 1162.41,
  36. 49.86,
  37. 3931.68,
  38. 17270.55]
  39. fig, ax = plt.subplots()
  40. ind = np.arange(N) # the x locations for the groups
  41. width = 0.30 # the width of the bars: can also be len(x) sequence
  42. p1 = ax.bar(ind, tgm1, width, label='$t_{gm}$ CRIANN')
  43. p2 = ax.bar(ind, tms1, width, bottom=tgm1, label='$t_{ms}$ CRIANN')
  44. p3 = ax.bar(ind + width, tgm2, width, label='$t_{gm}$ laptop')
  45. p4 = ax.bar(ind + width, tms2, width, bottom=tgm2, label='$t_{ms}$ laptop')
  46. ax.set_yscale('log', nonposy='clip')
  47. ax.set_xlabel('datasets')
  48. ax.set_ylabel('runtime($s$)')
  49. ax.set_title('Runtime of the shortest path kernel on all datasets')
  50. plt.xticks(ind + width / 2, ('Acyclic', 'Alkane', 'MAO', 'MUTAG', 'Letter-med', 'ENZYMES'))
  51. #ax.set_yticks(np.logspace(-16, -3, num=20, base=10))
  52. #ax.set_ylim(bottom=1e-15)
  53. ax.legend(loc='upper left')
  54. ax2 = ax.twinx()
  55. p1 = ax2.plot(ind + width / 2, np.array(tgm2) / np.array(tgm1), 'ro-',
  56. label='$t_{gm}$ laptop / $t_{gm}$ CRIANN')
  57. ax2.set_ylabel('ratios')
  58. ax2.legend(loc='upper center')
  59. plt.savefig('check_gm/compare_running_time.eps', format='eps', dpi=300)
  60. plt.show()

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