BetaDistribution<T>
Models & Types · AiDotNet.Distributions
Represents a Beta probability distribution.
Inheritance: DistributionBase<T> → BetaDistribution<T>
For Beginners
The Beta distribution is perfect for modeling probabilities or percentages (values between 0 and 1). Its shape is very flexible:
- α = β = 1: Uniform distribution
- α = β > 1: Bell-shaped, peaked at 0.5
- α > β: Skewed toward 1 (high probabilities more likely)
- α < β: Skewed toward 0 (low probabilities more likely)
It’s used extensively in A/B testing and Bayesian inference.
How It Works
The Beta distribution is defined on the interval [0, 1] and is commonly used to model random variables that represent proportions, probabilities, or bounded rates. It’s conjugate prior to the Binomial distribution in Bayesian statistics.
PDF: f(x) = (x^(α-1) * (1-x)^(β-1)) / B(α,β) for x ∈ [0,1]
Constructors
| Constructor | Summary |
|---|---|
BetaDistribution() |
Initializes a uniform Beta distribution (α=1, β=1). |
BetaDistribution(T alpha, T beta) |
Initializes a new Beta distribution. |
Properties
| Property | Summary |
|---|---|
T Alpha { get; } |
Gets the alpha shape parameter. |
T Beta { get; } |
Gets the beta shape parameter. |
T Mean { get; } |
|
T Variance { get; } |
|
Vector<T> Parameters { get; set; } |
|
int NumParameters { get; } |
|
string[] ParameterNames { get; } |
Methods
| Method | Summary |
|---|---|
BetaDistribution<T> FromMeanVariance(T mean, T variance) |
Creates a Beta distribution from mean and variance. |
BetaDistribution<T> FromSuccessFailure(int successes, int failures, T priorAlpha, T priorBeta) |
Creates a Beta distribution from a number of successes and failures (Bayesian posterior). |
IParametricDistribution<T> Clone() |
|
Matrix<T> FisherInformation() |
|
T Cdf(T x) |
|
T InverseCdf(T p) |
|
T LogPdf(T x) |
|
T Pdf(T x) |
|
T Sample(Random random) |
|
Vector<T> GradLogPdf(T x) |