Switch to Jeffrey prior (#153)

* Switch to Jeffrey

* Add Jeffrey priors

* Bring things back
This commit is contained in:
Richard Stiskalek 2024-09-26 11:59:50 +02:00 committed by GitHub
parent f7d16a9cd0
commit 52589a533f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -607,10 +607,15 @@ class PV_LogLikelihood(BaseFlowValidationModel):
Vmono = field_calibration_params["Vmono"] Vmono = field_calibration_params["Vmono"]
Vext_rad = project_Vext(Vext[0], Vext[1], Vext[2], self.RA, self.dec) Vext_rad = project_Vext(Vext[0], Vext[1], Vext[2], self.RA, self.dec)
e_mu = distmod_params["e_mu"]
# Jeffrey's prior on sigma_v and the intrinsic scatter, they are above
# "sampled" from uniform distributions.
ll0 -= jnp.log(sigma_v) + jnp.log(e_mu)
# ------------------------------------------------------------ # ------------------------------------------------------------
# 1. Sample true observables and obtain the distance estimate # 1. Sample true observables and obtain the distance estimate
# ------------------------------------------------------------ # ------------------------------------------------------------
e_mu = distmod_params["e_mu"]
if self.kind == "SN": if self.kind == "SN":
mag_cal = distmod_params["mag_cal"] mag_cal = distmod_params["mag_cal"]
alpha_cal = distmod_params["alpha_cal"] alpha_cal = distmod_params["alpha_cal"]
@ -624,6 +629,9 @@ class PV_LogLikelihood(BaseFlowValidationModel):
c_mean, c_std = sample_gaussian_hyperprior( c_mean, c_std = sample_gaussian_hyperprior(
"c", self.name, self.c_min, self.c_max) "c", self.name, self.c_min, self.c_max)
# Jeffrey's prior on the the MNR hyperprior widths.
ll0 -= jnp.log(mag_std) + jnp.log(x1_std) + jnp.log(c_std)
# NOTE: that the true variables are currently uncorrelated. # NOTE: that the true variables are currently uncorrelated.
with plate(f"true_SN_{self.name}", self.ndata): with plate(f"true_SN_{self.name}", self.ndata):
mag_true = sample( mag_true = sample(
@ -675,6 +683,9 @@ class PV_LogLikelihood(BaseFlowValidationModel):
corr_mag_eta = sample( corr_mag_eta = sample(
f"corr_mag_eta_{self.name}", Uniform(-1, 1)) f"corr_mag_eta_{self.name}", Uniform(-1, 1))
# Jeffrey's prior on the the MNR hyperprior widths.
ll0 -= jnp.log(mag_std) + jnp.log(eta_std)
loc = jnp.array([mag_mean, eta_mean]) loc = jnp.array([mag_mean, eta_mean])
cov = jnp.array( cov = jnp.array(
[[mag_std**2, corr_mag_eta * mag_std * eta_std], [[mag_std**2, corr_mag_eta * mag_std * eta_std],