{ } Raw JSON

bundles / scipy latest / scipy / stats / _distn_infrastructure / _sum_finite

function

scipy.stats._distn_infrastructure:_sum_finite

source: /scipy/stats/_distn_infrastructure.py :482

Signature

def   _sum_finite ( x )

Summary

For a 1D array x, return a tuple containing the sum of the finite values of x and the number of nonfinite values.

Extended Summary

This is a utility function used when evaluating the negative loglikelihood for a distribution and an array of samples.

Examples

import numpy as np
from scipy.stats._distn_infrastructure import _sum_finite
tot, nbad = _sum_finite(np.array([-2, -np.inf, 5, 1]))
tot
nbad

Aliases

  • scipy.stats._distn_infrastructure._sum_finite