torch.distributions.Wishart
class Wishart extends Distributionnew Wishart(df: number | Tensor, options: {
covariance_matrix?: Tensor;
precision_matrix?: Tensor;
scale_tril?: Tensor;
} & DistributionOptions)
- readonly
df(Tensor) - – Degrees of freedom (must be >= dimension of the matrix).
- readonly
arg_constraints(unknown) - readonly
support(unknown) - readonly
has_rsample(unknown) - readonly
scale_tril(Tensor) - – Get the Cholesky factor of the scale matrix.
- readonly
covariance_matrix(Tensor) - – Get the covariance/scale matrix.
- readonly
mean(Tensor) - readonly
mode(Tensor) - readonly
variance(Tensor)
Wishart distribution: distribution over positive-definite matrices.
Parameterized by df (degrees of freedom) and scale matrix S. Essential for:
- Conjugate prior for covariance/precision matrices in multivariate normal
- Bayesian multivariate regression
- Inverse Wishart priors (for covariance matrices)
- Covariance matrix estimation with uncertainty
- Gaussian graphical models and structure learning
- Hierarchical Bayesian models with matrix-valued parameters
The probability density function involves positive-definite matrices. Support: Space of d×d positive-definite symmetric matrices
Examples
const m = new Wishart(
5, // degrees of freedom (must be >= dim)
{ scale_tril: torch.eye(3) }
);
m.sample(); // sample a 3x3 positive definite matrix