code: Comparing Wasserstein and Euclidean distance
This commit is contained in:
@ -32,7 +32,8 @@ def main(args):
|
||||
plt.xlabel('Landmarks (%)') # Set x axis label.
|
||||
plt.xlim(x_i.min() - x_margin, x_i.max() + x_margin)
|
||||
# The y axis
|
||||
plt.ylabel('Mean absolute error') # Set y axis label.
|
||||
# plt.yscale('log')
|
||||
plt.ylabel('Euclidean distance') # Set y axis label.
|
||||
# Bar offset
|
||||
x_offset = -(bar_width/2)*(len(dist_type) - 1)
|
||||
for d_i, d in enumerate(dist_type):
|
||||
@ -50,8 +51,9 @@ def main(args):
|
||||
hist, h = lmdk_lib.get_hist(seq, lmdks)
|
||||
opts = lmdk_sel.get_opts_from_top_h(seq, lmdks)
|
||||
delta = 1.0
|
||||
res, _ = exp_mech.exponential_pareto(hist, opts, exp_mech.score, delta, epsilon)
|
||||
mae[n_i] += lmdk_lib.get_norm(hist, res)/args.reps
|
||||
res, _ = exp_mech.exponential(hist, opts, exp_mech.score, delta, epsilon)
|
||||
mae[n_i] += lmdk_lib.get_norm(hist, res)/args.reps # Euclidean
|
||||
# mae[n_i] += lmdk_lib.get_emd(hist, res)/args.reps # Wasserstein
|
||||
print('[OK]', flush=True)
|
||||
# Plot bar for current distribution
|
||||
plt.bar(
|
||||
@ -63,7 +65,7 @@ def main(args):
|
||||
)
|
||||
# Change offset for next bar
|
||||
x_offset += bar_width
|
||||
path = str('../../rslt/lmdk_sel_cmp-pareto/' + 'lmdk_sel_cmp')
|
||||
path = str('../../rslt/lmdk_sel_cmp/' + 'lmdk_sel_cmp-norm')
|
||||
# Plot legend
|
||||
lmdk_lib.plot_legend()
|
||||
# Show plot
|
||||
|
Reference in New Issue
Block a user