|
@@ -2,20 +2,22 @@ import numpy as np
|
|
|
from scipy.stats import dirichlet
|
|
|
import ternary
|
|
|
|
|
|
-scale = 1
|
|
|
+scale = 60
|
|
|
|
|
|
x = np.load("votes_distrib.npz")
|
|
|
alphas = x["alphas"].mean(axis=0)
|
|
|
|
|
|
def prob(p):
|
|
|
- try:
|
|
|
- return dirichlet.pdf(p, alphas)
|
|
|
- except:
|
|
|
- return np.array([np.nan, np.nan, np.nan])
|
|
|
+ p = np.array(p)
|
|
|
+ print(p)
|
|
|
+ if np.all(p>0):
|
|
|
+ return dirichlet.logpdf(p, alphas)
|
|
|
+ else:
|
|
|
+ return 0
|
|
|
|
|
|
figure, tax = ternary.figure(scale=scale)
|
|
|
tax.heatmapf(prob, boundary=True, style="triangular")
|
|
|
tax.boundary(linewidth=2.0)
|
|
|
tax.set_title("Shannon Entropy Heatmap")
|
|
|
|
|
|
-tax.savefig("votes_distrib.eps")
|
|
|
+tax.savefig("votes_distrib.eps")
|