-
Notifications
You must be signed in to change notification settings - Fork 0
/
tflip_vs_m.py
31 lines (26 loc) · 1.24 KB
/
tflip_vs_m.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, k_rsm3, eps_rsm3 = 10, 1, 0.1
nItrs_rsm3 = 200
m_bounds_rsm3 = (2, 12000, 100)
model_rsm3 = rl.TailFlipModel()
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, k=k_rsm3, eps=eps_rsm3, nItrs=nItrs_rsm3)
ylims_rsm3 = (0, 1)
xs = []
inputfilename_rsm3 = 'data/tailflip-loss-vs-m-pkl'
outputfilename_rsm3 = 'figs/tailflip-loss-vs-m.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, 'm', m_bounds_rsm3, trials_rsm3, ylims_rsm3, explicit_xs=False, xs=xs)
title_rsm3 = 'd = {d}, k = {k}, eps = {eps}, Noise is tail flipping'.format(d=d_rsm3, k=k_rsm3, eps=eps_rsm3)
xlabel_rsm3 = 'n'
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, 'm', m_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('tailfip-loss-vs-m')