In [ ]:
reload("repl.jl");

In [ ]:
xdump(sim)

In [ ]:
using PyPlot;
PyPlot.svg(false);

In [ ]:
subplot(221);
colorbar(contourf(mean_repdelta["hierarchical"], origin="upper"));
title("hierarchical");
ylabel("reporter");

subplot(222);
colorbar(contourf(mean_repdelta["cflash"], origin="upper"));
title("cflash");

subplot(223);
contourf(mean_repdelta["PCA"], origin="upper");
title("PCA");
xlabel("reporting round");
ylabel("reporter");

subplot(224);
colorbar(contourf(mean_repdelta["k-means"], origin="upper"));
title("k-means");
xlabel("reporting round");

In [ ]:
function buildplot(metric)
    plot(1:sim.TIMESTEPS, mean(track["PCA"][metric], 2),
         1:sim.TIMESTEPS, mean(track["cflash"][metric], 2),
         1:sim.TIMESTEPS, mean(track["fixed-variance"][metric], 2),
         1:sim.TIMESTEPS, mean(track["k-means"][metric], 2),
         1:sim.TIMESTEPS, mean(track["hierarchical"][metric], 2))
end

fig = figure();

subplot(221);
buildplot(:MCC)
grid();
ylabel("Matthews corr. coeff.");
legend(["PCA", "cflash", "fixed-variance", "k-means", "hierarchical"],
       bbox_to_anchor=(-0.15, 1.35),
       loc="upper left",
       ncol=4);

subplot(222);
buildplot(:spearman)
ax = gca();
ax[:yaxis][:set_ticks_position]("right");
ax[:set_xscale]("linear");
ylabel("spearman rank corr.");
grid();

subplot(223);
buildplot(:beats)
ax = gca();
ax[:set_xscale]("log");
xlabel("reporting round");
ylabel("beats");
grid();

subplot(224);
buildplot(:liars_bonus)
xlabel("reporting round");
ylabel("liars' bonus");
ax = gca();
ax[:yaxis][:set_ticks_position]("right");
ax[:set_xscale]("log");
grid();

fig[:canvas][:draw]();

In [ ]:
fig = figure();
errorbar(timesteps, mean_rep_liars["PCA"], yerr=std_rep_liars["PCA"]);
hold("on");
errorbar(timesteps, mean_rep_liars["cflash"], yerr=std_rep_liars["cflash"]);
errorbar(timesteps, mean_rep_liars["fixed-variance"], yerr=std_rep_liars["fixed-variance"]);
errorbar(timesteps, mean_rep_liars["k-means"], yerr=std_rep_liars["k-means"]);
errorbar(timesteps, mean_rep_liars["hierarchical"], yerr=std_rep_liars["hierarchical"]);
xlabel("time (# reporting rounds)");
ylabel("liars' reputation");
ax = gca();
ax[:set_xscale]("linear");
grid();
legend(["PCA", "cflash", "fixed-variance", "k-means", "hierarchical"],
       loc="center right",
       bbox_to_anchor=(1.4, 0.55),
       ncol=1);
fig[:canvas][:draw]();

In [ ]:
fig = figure();
metric = :MCC;
timesteps = 1:sim.TIMESTEPS;
errorbar(timesteps, mean(track["PCA"][metric], 2), yerr=std(track["PCA"][metric], 2) / sim.SQRTN);
hold("on");
errorbar(timesteps, mean(track["cflash"][metric], 2), yerr=std(track["cflash"][metric], 2) / sim.SQRTN);
errorbar(timesteps, mean(track["fixed-variance"][metric], 2), yerr=std(track["fixed-variance"][metric], 2) / sim.SQRTN);
errorbar(timesteps, mean(track["k-means"][metric], 2), yerr=std(track["k-means"][metric], 2) / sim.SQRTN);
errorbar(timesteps, mean(track["hierarchical"][metric], 2), yerr=std(track["hierarchical"][metric], 2) / sim.SQRTN);
grid();
xlabel("time (# reporting rounds)");
ylabel("Matthews corr. coeff.");
legend(["PCA", "cflash", "fixed-variance", "k-means", "hierarchical"],
       loc="center right",
       bbox_to_anchor=(1.4, 0.55),
       ncol=1);
fig[:canvas][:draw]();