SepiaPrior

SepiaPrior stores distribution name, parameters, and bounds, and knows how to compute its own log prior.

class sepia.SepiaPrior(parent, dist='Normal', params=None, bounds=None, fcon=None)

Sepia prior class, containing prior distribution name, parameters, and bounds.

Variables
  • parent (sepia.SepiaParam) – parameter that this prior corresponds to

  • dist (string) – which prior distribution, in [‘Normal’, ‘Gamma’, ‘Beta’, ‘Uniform’]

  • params (list) – each element is a different parameter to the distribution (ie first is mean, second is SD), can be matrix valued

  • bounds (list) – bounds for each prior (can be np.inf)

  • fcon (function) – constraints function (for thetas)

Instantiate SepiaPrior object.

Parameters
  • parent (sepia.SepiaParam) – parameter that this prior corresponds to

  • dist (string) – which prior distribution, in [‘Normal’, ‘Gamma’, ‘Beta’, ‘Uniform’]

  • params (list/NoneType) – each element is a different parameter to the distribution (ie first is mean, second is SD), can be matrix valued

  • bounds (list/NoneType) – bounds for each prior (can be np.inf)

  • fcon (function/NoneType) – constraints function returning bool (for theta only)

Raises

ValueError – if invalid dist type or non-conformal shapes

compute_log_prior()

Compute log prior for this particular parent SepiaParam object.

Returns

log prior value

is_in_bounds(x=None)

Check whether value is in bounds. By default, with no x, checks self.parent.val.

Parameters

x (numpy.ndarray/NoneType) – value with self.parent.val_shape; if None, defaults to self.parent.val

Returns

True if all in bounds, False otherwise

obeys_constraint(x=None)

Check whether value obeys constraint function. By default, with no x, checks self.parent.val.

Parameters

x (numpy.ndarray/NoneType) – value with self.parent.val_shape; if None, defaults to self.parent.val

Returns

True if constraint function satisfied, False otherwise