Skip to content

Commit

Permalink
change eps to mean(eff) (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
zihaoxu98 authored Jul 26, 2024
1 parent b365b2a commit 08fe243
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions appletree/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 08fe243

Please sign in to comment.