code: def particle_meanfn(weights, locations, fn=None):
      r
      warnings.warn('particle_meanfn is deprecated, please use distributions.ParticleDistribution',
                    DeprecationWarning)
      fn_vals = fn(locations) if fn is not None else locations
      return np.sum(weights * fn_vals.transpose([1, 0]),
          axis=1)
docs: r"""
      Returns the mean of a function :math:`f` over model
      parameters.
  
      :param numpy.ndarray weights: Weights of each particle.
      :param numpy.ndarray locations: Locations of each
          particle.
      :param callable fn: Function of model parameters to
          take the mean of. If `None`, the identity function
          is assumed.