Commit da0879c1 authored by Azat Garifullin's avatar Azat Garifullin
Browse files

posterior mean vis

parent c5865b1f
No preview for this file type
No preview for this file type
No preview for this file type
......@@ -61,7 +61,7 @@ Let's consider a model:
\end{gather}
where \(\mathbf{y}\) is an observed field, \(\mathbf{z}\) is a hidden field, and
\(\mathcal{K}\) is a Mat\'{e}rn covariance function with parameters
\(\theta = (\sigma, l, \sigma)\):
\(\theta = (\nu, l, \sigma)\):
\begin{equation}
\mathcal{K}(\rho) =
\frac{\sigma^2 2^{1 - \nu}}{\Gamma(\nu)}
......@@ -70,7 +70,7 @@ where \(\mathbf{y}\) is an observed field, \(\mathbf{z}\) is a hidden field, and
\right)^{\nu}
K_{\nu} \left(
\frac{\sqrt{2\nu} \rho}{l}
\right)^{\nu},
\right),
\end{equation}
where \(\Gamma\) is the gamma function and \(K_{\nu}\) is the modified Bessel function of the second kind.
......@@ -107,7 +107,7 @@ where \(\Gamma\) is the gamma function and \(K_{\nu}\) is the modified Bessel fu
\subfloat[]{\includegraphics[width=0.30\textwidth]{k_smooth_2_1}}
\hfil
\subfloat[]{\includegraphics[width=0.30\textwidth]{k_smooth_2_2}}
\caption{Sampled Mat\'{e}rn dields for rows: \( \nu = 0.5 \),
\caption{Sampled Mat\'{e}rn fields for rows: \( \nu = 0.5 \),
\( \nu = 1 \), \( \nu = 2.5 \). For all samples \( \sigma = 1 \)
and \( l = 2 \).}
\label{fig:samples}
......
......@@ -14,6 +14,8 @@ def main():
with open('./data/field.pickle', 'rb') as f:
xs, ys, field, nu, sigma, l = pickle.load(f)
w, h = np.size(xs), np.size(ys)
print("Pre-evaluating distance matrix")
dist_mtx = rf.dist_matrix(xs, ys)
flat_gt_field = np.ravel(field)
......@@ -22,7 +24,7 @@ def main():
noise = np.random.normal(scale=noise_sigma, size=flat_gt_field.shape)
initial_field = flat_gt_field + noise
initial_theta = np.array([nu, sigma, l]) + 1e-2
initial_theta = np.array([nu, sigma, l]) + 0.7
proposal_cov = 1e-4 * np.eye(3)
lower = np.array([0.5, 0.5, 0.5])
......@@ -37,6 +39,21 @@ def main():
with open('./data/matern_chain.pickle', 'wb') as f:
pickle.dump(chain_res, f)
chain, p_accs, nlls = chain_res
theta_chain, field_chain = zip(*chain)
figs_outpath = './figs/dummy_matern/'
os.makedirs(figs_outpath, exist_ok=True)
rf.show_theta_chain(theta_chain, p_accs, nlls, figs_outpath)
field_mean, _ = rf.estimate_field_norm_posterior(field_chain, w, h, figs_outpath)
field_err = field - field_mean
plt.figure()
plt.imshow(field_err)
plt.colorbar()
plt.title("GT - mean estimate")
plt.savefig(os.path.join(figs_outpath, "field_err.png"))
plt.close()
if __name__ == '__main__':
random.seed(42)
......
......@@ -38,7 +38,7 @@ def main():
lower=lower, upper=upper
)
with open('./data/matern_chain.pickle', 'wb') as f:
with open('./data/margl_chain.pickle', 'wb') as f:
pickle.dump(chain_res, f)
chain, p_accs, nlls = chain_res
......
figs/dist_mtx.png

89.9 KB | W: | H:

figs/dist_mtx.png

446 KB | W: | H:

figs/dist_mtx.png
figs/dist_mtx.png
figs/dist_mtx.png
figs/dist_mtx.png
  • 2-up
  • Swipe
  • Onion skin
figs/k_smooth_05_0.png

14.8 KB | W: | H:

figs/k_smooth_05_0.png

16.1 KB | W: | H:

figs/k_smooth_05_0.png
figs/k_smooth_05_0.png
figs/k_smooth_05_0.png
figs/k_smooth_05_0.png
  • 2-up
  • Swipe
  • Onion skin
figs/k_smooth_05_1.png

15.4 KB | W: | H:

figs/k_smooth_05_1.png

19.4 KB | W: | H:

figs/k_smooth_05_1.png
figs/k_smooth_05_1.png
figs/k_smooth_05_1.png
figs/k_smooth_05_1.png
  • 2-up
  • Swipe
  • Onion skin
figs/k_smooth_05_2.png

17.9 KB | W: | H:

figs/k_smooth_05_2.png

16.2 KB | W: | H:

figs/k_smooth_05_2.png
figs/k_smooth_05_2.png
figs/k_smooth_05_2.png
figs/k_smooth_05_2.png
  • 2-up
  • Swipe
  • Onion skin
figs/k_smooth_05_cov_mtx.png

101 KB | W: | H:

figs/k_smooth_05_cov_mtx.png

141 KB | W: | H:

figs/k_smooth_05_cov_mtx.png
figs/k_smooth_05_cov_mtx.png
figs/k_smooth_05_cov_mtx.png
figs/k_smooth_05_cov_mtx.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment