Mixin Classes for Model Development¶
ScoreMixin
 Numerical Differentiation for Fisher Scores¶

class
qinfer.
ScoreMixin
[source]¶ Bases:
object
A mixin which includes a method
score
that numerically estimates the score of the likelihood function. Any class which mixes in this class should be equipped with a propertyn_modelparams
and a methodlikelihood
to satisfy dependency.
h
¶ Returns the step size to be used in numerical differentiation with respect to the model parameters.
The step size is given as a vector with length
n_modelparams
so that each model parameter can be weighted independently.

score
(outcomes, modelparams, expparams, return_L=False)[source]¶ Returns the numerically computed score of the likelihood function, defined as:
\[q(d, \vec{x}; \vec{e}) = \vec{\nabla}_{\vec{x}} \log \Pr(d  \vec{x}; \vec{e}).\]Calls are represented as a fourindex tensor
score[idx_modelparam, idx_outcome, idx_model, idx_experiment]
. The leftmost index may be suppressed for singleparameter models.The numerical gradient is computed using the central difference method, with step size given by the property
h
.If return_L is True, both
q
and the likelihoodL
are returned asq, L
.
