mlnext.score.bern_log_likelihood#

mlnext.score.bern_log_likelihood(x: ndarray, mean: ndarray) ndarray[source]#

Calculates the log likelihood of x being produced by a bernoulli distribution parameterized by mean.

\[LL(x|\text{mean}) = x \cdot \log(\text{mean}) + (1 - x) \cdot \log(\text{mean})\]
Parameters:
  • x (np.ndarray) – Samples.

  • mean (np.ndarray) – Mean of the bernoulli distribution.

Returns:

Returns the negative log likelihood.

Return type:

np.ndarray