A Test of the Impact of Truncation on Stability


In [1]:
import matplotlib.pyplot as plt

In [6]:
%run src/by_mc_truncation_test.py

In [7]:
by = BY()

In [8]:
f = by_function_factory(by)

In [17]:
seed=1234
f(seed=seed)


Out[17]:
0.9980336103784864

In [18]:
G = 20
trunc_vals = np.linspace(0.5, 5.0, G)

In [19]:
out = []
for t in trunc_vals:
    out.append(f(trunc_val=t, seed=seed))

In [20]:
out


Out[20]:
[0.9983371084557432,
 0.9982824880834684,
 0.9982343918886304,
 0.9981837940353663,
 0.9981413677493143,
 0.998104084978947,
 0.9980782773927358,
 0.998061619985821,
 0.9980505078544315,
 0.9980409701727383,
 0.9980349531384684,
 0.9980335757831346,
 0.9980335814667566,
 0.9980336045542854,
 0.9980336130095916,
 0.9980336106122082,
 0.998033610402091,
 0.9980336103822163,
 0.9980336103784795,
 0.9980336103784839]

In [23]:
fig, ax = plt.subplots()
ax.plot(trunc_vals, out, label="$\Lambda$ with truncation")
ax.plot(trunc_vals, np.ones(G) * f(seed=seed), "k--",  label="$\Lambda$ without explicit truncation")
ax.set_ylim((0.9978, 0.9984))
ax.set_ylabel("$\Lambda$")
ax.set_xlabel("truncation value")
ax.legend()
plt.savefig("temp.pdf")



In [ ]: