-
Notifications
You must be signed in to change notification settings - Fork 0
/
que_vs_k.py
31 lines (26 loc) · 1.24 KB
/
que_vs_k.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import robustlib as rl
import matplotlib.pyplot as plt
trials_rsm3 = 10
figsize=(8,4)
fontname='serif'
fsize=20
fpad=10
d_rsm3, eps_rsm3, m_rsm3 = 300, 0.1, 5000
nItrs_rsm3 = 200
k_bounds_rsm3 = (1, 200, 20)
model_rsm3 = rl.QUESyntheticModel()
keys_rsm3 = [rl.Oracle, rl.RME_sp, rl.NP_sp, rl.ransacGaussianMean, rl.GDAlgs]
#keys_rsm3 = [rl.GDAlgs]
model_params_rsm3 = rl.Params(d=d_rsm3, m=m_rsm3, eps=eps_rsm3, nItrs=nItrs_rsm3)
ylims_rsm3 = (0, 1)
xs = []
inputfilename_rsm3 = 'data/que-loss-vs-k-pkl'
outputfilename_rsm3 = 'figs/que-loss-vs-k.pdf'
plot_m_loss_rsm3 = rl.load_data(model_rsm3, model_params_rsm3, rl.err, keys_rsm3)
plot_m_loss_rsm3.setdata_tofile(inputfilename_rsm3, 'k', k_bounds_rsm3, trials_rsm3, ylims_rsm3, explicit_xs=False, xs=xs)
title_rsm3 = 'd = {d}, m = {m}, eps = {eps}, Noise is in multiple directions'.format(d=d_rsm3, m=m_rsm3, eps=eps_rsm3)
xlabel_rsm3 = 'k'
ylabel_rsm3 = 'L2 loss'
plot_m_loss_rsm3_plt = rl.plot_data(model_rsm3, model_params_rsm3, rl.err, keys_rsm3)
plot_m_loss_rsm3_plt.plotxy_fromfile(outputfilename_rsm3, inputfilename_rsm3, 'k', k_bounds_rsm3, (0, 1), title_rsm3, xlabel_rsm3, ylabel_rsm3, figsize=figsize, fsize=fsize, fpad=fpad, fontname=fontname, explicit_xs = False, xs = xs)
plt.savefig('que-loss-vs-k')