plot_votes_distrib.py 409 B

12345678910111213141516171819
  1. import numpy as np
  2. from scipy.stats import dirichlet
  3. import ternary
  4. scale = 1
  5. x = np.load("votes_distrib.npz")
  6. alphas = x["alphas"].mean(axis=0)
  7. def prob(p):
  8. print(p)
  9. return dirichlet.pdf(p, alphas)
  10. figure, tax = ternary.figure(scale=scale)
  11. tax.heatmapf(prob, boundary=True, style="triangular")
  12. tax.boundary(linewidth=2.0)
  13. tax.set_title("Shannon Entropy Heatmap")
  14. tax.savefig("votes_distrib.eps")