Skip to content

Commit

Permalink
use MLE for NPs in ToyCalculator scikit-hep#1426
Browse files Browse the repository at this point in the history
  • Loading branch information
masonproffitt committed Sep 24, 2021
1 parent 02b1951 commit 8c0f8a8
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/pyhf/infer/calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,13 +699,21 @@ def distributions(self, poi_test, track_progress=None):
tensorlib, _ = get_backend()
sample_shape = (self.ntoys,)

signal_pars = self.pdf.config.suggested_init()
signal_pars[self.pdf.config.poi_index] = poi_test
signal_pars = fixed_poi_fit(poi_test,
self.data,
self.pdf,
self.init_pars,
self.par_bounds,
self.fixed_params)
signal_pdf = self.pdf.make_pdf(tensorlib.astensor(signal_pars))
signal_sample = signal_pdf.sample(sample_shape)

bkg_pars = self.pdf.config.suggested_init()
bkg_pars[self.pdf.config.poi_index] = 1.0 if self.test_stat == 'q0' else 0.0
bkg_pars = fixed_poi_fit(0.0,
self.data,
self.pdf,
self.init_pars,
self.par_bounds,
self.fixed_params)
bkg_pdf = self.pdf.make_pdf(tensorlib.astensor(bkg_pars))
bkg_sample = bkg_pdf.sample(sample_shape)

Expand Down

0 comments on commit 8c0f8a8

Please sign in to comment.