From 1f66fb4fd9ef9143904eb27c84e6d2bcdce59d5f Mon Sep 17 00:00:00 2001 From: Zihao Xu Date: Fri, 26 Jul 2024 03:12:41 +0800 Subject: [PATCH] change eps to mean(eff) --- appletree/component.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/appletree/component.py b/appletree/component.py index 2396d76d..c49d3e43 100644 --- a/appletree/component.py +++ b/appletree/component.py @@ -53,13 +53,6 @@ def __init__(self, name: Optional[str] = None, llh_name: Optional[str] = None, * if "bins" in kwargs.keys() and "bins_type" in kwargs.keys(): self.set_binning(**kwargs) - if self.bins_type != "meshgrid" and self.add_eps_to_hist: - warn( - "It is empirically dangerous to have add_eps_to_hist==True, " - "when your bins_type is not meshgrid! It may lead to very bad fit with " - "lots of eff==0." - ) - def set_binning(self, **kwargs): """Set binning of component.""" if "bins" not in kwargs.keys() or "bins_type" not in kwargs.keys(): @@ -158,7 +151,8 @@ def implement_binning(self, mc, eff): raise ValueError(f"Unsupported bins_type {self.bins_type}!") if self.add_eps_to_hist: # as an uncertainty to prevent blowing up - hist = jnp.clip(hist, 1.0, jnp.inf) + # uncertainty = 1e-10 + jnp.mean(eff) + hist = jnp.clip(hist, 1e-10 + jnp.mean(eff), jnp.inf) return hist def get_normalization(self, hist, parameters, batch_size=None):