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 2.6 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 = 7
  11. tgm1 = np.array([0.73,
  12. 0.88,
  13. 1.65,
  14. 1.97,
  15. 4.89,
  16. 36.98,
  17. 704.54])
  18. tgm2 = np.array([0.77,
  19. 1.22,
  20. 2.95,
  21. 5.70,
  22. 20.29,
  23. 147.09,
  24. 3477.65])
  25. tms1 = np.array([2.68,
  26. 3.41,
  27. 3.36,
  28. 237.00,
  29. 7.58,
  30. 255.48,
  31. 717.35])
  32. tms2 = np.array([3.93,
  33. 4.96,
  34. 5.84,
  35. 833.06,
  36. 26.62,
  37. 807.84,
  38. 3515.72])
  39. fig, ax = plt.subplots(1, 1, figsize=(10.5, 4.2))
  40. ind = np.arange(N) # the x locations for the groups
  41. width = 0.23 # the width of the bars: can also be len(x) sequence
  42. p1 = ax.bar(ind - width * 0.03, tgm1, width, label='compute Gram matrix on $CRIANN$ ($t_1$)', zorder=3)
  43. p2 = ax.bar(ind - width * 0.03, tms1 - tgm1, width, bottom=tgm1, label='model selection on $CRIANN$', zorder=3)
  44. p3 = ax.bar(ind + width * 1.03, tgm2, width, label='compute Gram matrix on $laptop$ ($t_2$)', zorder=3)
  45. p4 = ax.bar(ind + width * 1.03, tms2 - tgm2, width, bottom=tgm2, label='model selection on $laptop$', zorder=3)
  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, ('Alkane', 'Acyclic', 'MAO', 'PAH', 'MUTAG',
  51. 'Letter-med', 'ENZYMES'))
  52. #ax.set_yticks(np.logspace(-16, -3, num=20, base=10))
  53. #ax.set_ylim(bottom=1e-15)
  54. ax.grid(axis='y', zorder=0)
  55. ax.spines['top'].set_visible(False)
  56. ax.spines['bottom'].set_visible(False)
  57. ax.spines['left'].set_visible(False)
  58. ax.spines['right'].set_visible(False)
  59. ax.xaxis.set_ticks_position('none')
  60. ax2 = ax.twinx()
  61. p5 = ax2.plot(ind + width / 2, tgm2 / tgm1, 'bo-',
  62. label='$t_2 / $ $t_1$')
  63. ax2.set_ylabel('ratios')
  64. ax2.spines['top'].set_visible(False)
  65. ax2.spines['bottom'].set_visible(False)
  66. ax2.spines['left'].set_visible(False)
  67. ax2.spines['right'].set_visible(False)
  68. ax2.xaxis.set_ticks_position('none')
  69. ax2.yaxis.set_ticks_position('none'
  70. )
  71. ax.yaxis.set_ticks_position('none')
  72. fig.subplots_adjust(right=0.63)
  73. fig.legend(loc='right', ncol=1, frameon=False) # , ncol=5, labelspacing=0.1, handletextpad=0.4, columnspacing=0.6)
  74. plt.savefig('../check_gm/parallel_runtime_on_different_machines.eps', format='eps', dpi=300,
  75. transparent=True, bbox_inches='tight')
  76. plt.show()

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