Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def likelihood(self, outcomes, modelparams, expparams):
# By calling the superclass implementation, we can consolidate
# call counting there.
super(AsymmetricLossModel, self).likelihood(outcomes, modelparams, expparams)
pr1 = self._eta * self.underlying_model.likelihood(
np.array([1], dtype='uint'),
modelparams,
expparams
)[0, :, :]
# Now we concatenate over outcomes.
L = qi.FiniteOutcomeModel.pr0_to_likelihood_array(outcomes, 1 - pr1)
assert not np.any(np.isnan(L))
return L
def __init__(self, freq_min=0.0, freq_max=1.0, n_particles=1000, noise="Absent", eta=1.0):
base_model = ExpDecoKnownPrecessionModel(min_freq=freq_min)
if noise is "Absent":
self.model = base_model
elif noise is "Binomial":
self.model = qi.BinomialModel(base_model)
elif noise is "Unbalanced":
self.model = qi.BinomialModel(AsymmetricLossModel(base_model, eta=eta))
self.n_particles = n_particles
self.freq_min = freq_min
self.freq_max = freq_max
self.fft_est = None
self.bay_est = None