Exemple #1
0
def nlp_transform(log10hyp):
    hyp = 10**log10hyp
    return nll(hyp, xtrain, ytrain) + nlprior(log10hyp)
Exemple #2
0
def nll_transform(log10hyp):
    hyp = 10**log10hyp
    return nll(hyp, xtrain, ytrain, 0)
Exemple #3
0
# plt.plot(x, [cutoff(xi, -6, 0) for xi in x])
# plt.show()

########### PLOT 3D CURVE ###########

res = scipy.optimize.minimize(nlp_transform, np.array([-1, -6]), method='BFGS')

nl = 50
ns2 = 40

log10l = np.linspace(res.x[0] - 2, res.x[0] + 2, nl)
log10s2 = np.linspace(res.x[1] - 2, res.x[1] + 2, ns2)
[Ll, Ls2] = np.meshgrid(log10l, log10s2)

nlls = np.array([
    nll([10**ll, 10**ls2], xtrain, ytrain, 0) for ls2 in log10s2
    for ll in log10l
]).reshape([ns2, nl])

fig = plt.figure()
plt.title('NLL')
ax = plt.axes(projection='3d')
ax.contour3D(Ls2, Ll, nlls, 50, cmap='autumn')
ax.set_xlabel('log10 l^2')
ax.set_ylabel('log10 sig_n^2')
ax.set_zlabel('nll')

plt.show()

# # Do some cut for visualization
# maxval = 2.0