Skip to content

Commit

Permalink
update README.md; hide compiletime stress test
Browse files Browse the repository at this point in the history
  • Loading branch information
pfackeldey committed Mar 20, 2024
1 parent 2854ccc commit 1307a8b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ plots_analysis_opt/
# presentation code snippets
examples/presentation_snippets.py

# compiletime stress test
# compile time stress test
examples/compiletime.py

test/
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ jax.config.update("jax_enable_x64", True)

# define a simple model with two processes and two parameters
class Model(eqx.Module):
mu: evm.Parameter
syst: evm.Parameter
mu: evm.FreeFloating
syst: evm.NormalConstrained

def __call__(self, hists: dict[str, Array]) -> Array:
mu_modifier = self.mu.unconstrained()
Expand All @@ -61,15 +61,15 @@ def loss(model: Model, hists: dict[str, Array], observation: Array) -> Array:
# Poisson NLL of the expectation and observation
log_likelihood = nll(expectation, observation)
# Add parameter constraints from logpdfs
constraints = evm.loss.get_param_constraints(model)
constraints = evm.loss.get_logpdf_constraints(model)
log_likelihood += evm.util.sum_leaves(constraints)
return -jnp.sum(log_likelihood)


# setup model and data
hists = {"signal": jnp.array([3]), "bkg": jnp.array([10])}
observation = jnp.array([15])
model = Model(mu=evm.Parameter(1.0), syst=evm.Parameter(0.0))
model = Model(mu=evm.FreeFloating(), syst=evm.NormalConstrained())

# negative log-likelihood
loss_val = loss(model, hists, observation)
Expand Down

0 comments on commit 1307a8b

Please sign in to comment.