Cauchy#
- class zfit.prior.Cauchy(m, gamma, name=None)[source]#
Bases:
BasePriorCauchy prior distribution.
The Cauchy distribution is a heavy-tailed distribution that doesn’t have a defined mean or variance. Its heavy tails make it useful for robust inference when outliers are expected or when you want to express very weak prior information.
This prior is suitable for: - Robust modeling when outliers are expected - Parameters where extreme values are plausible - Weakly informative priors that still allow for surprises - Location parameters with high uncertainty
Properties: - No finite mean or variance (moments don’t exist) - Median and mode equal the location parameter m - Heavy tails decrease as 1/x²
Example
>>> # Cauchy centered at 0 with scale 1 (standard Cauchy) >>> prior = Cauchy(m=0.0, gamma=1.0) >>> >>> # Cauchy centered at 10 with wider scale >>> prior = Cauchy(m=10.0, gamma=5.0)
Warning
Due to its heavy tails, the Cauchy can lead to slower MCMC convergence. Consider using a Student-t with low degrees of freedom as an alternative with finite variance.
Initialize a Cauchy prior.
- Parameters:
- __eq__(other)#
Compare two priors for equality.
- Parameters:
other – Another ZfitPrior instance to compare with
- Returns:
True if the priors are equal
- Return type:
- __hash__()#
Return hash of the prior based on pdf and name.
- Returns:
Hash value for the prior
- Return type:
- log_pdf(value=None)#
Return the log probability of the prior at the given value(s).
- Parameters:
value – The parameter value(s) to evaluate the log probability at
- Returns:
The log probability
- sample(n)#
Sample n values from the prior distribution.
- Parameters:
n – Number of samples to draw
- Returns:
An array of samples