BayesianNonparametrics.DPMData
— TypeDirichlet Process Mixture Model Data Object
BayesianNonparametrics.DPMHyperparam
— TypeDirichlet Process Mixture Model Hyperparameters
BayesianNonparametrics.GammaNormal
— MethodGammaNormal(; μ0 = 0.0, λ0 = 1.0, α0 = 1.0, β0 = 1.0)
Normal-Gamma distribution
A Normal-Gamma distribution is the conjugate prior of a Normal distribution with unknown mean and precision.
Paramters
μ0
: locationλ0 > 0
: number of pseudo-observationsα0 > 0
β0 > 0
Example:
d = GammaNormal()
BayesianNonparametrics.HDPHyperparam
— TypeHierarchical Dirichlet Process Mixture Model Hyperparameters
BayesianNonparametrics.WishartGaussian
— MethodWishartGaussian(μ0, κ0, ν0, Σ0)
Gaussian-inverse-Wishart distribution
A Gaussian-inverse-Wishart distribution is the conjugate prior of a multivariate normal distribution with unknown mean and covariance matrix.
Parameters
μ0, Dx1
: locationκ0 > 0
: number of pseudo-observationsν0 > D-1
: degrees of freedomΣ0 > 0, DxD
: scale matrix
Example
julia> (N, D) = size(X)
julia> μ0 = mean(X, dims = 1)
julia> d = WishartGaussian(μ0, 1.0, 2*D, cov(x))
BayesianNonparametrics.add!
— Methodadd!(d::ConjugatePostDistribution, X)
Add data to Posterior Distribution (inplace).
BayesianNonparametrics.add
— Methodadd(d::ConjugatePostDistribution, X)
Add data to Posterior Distribution.
BayesianNonparametrics.init
— MethodHDP initialization using random assignments.
BayesianNonparametrics.logpostpred
— MethodLog PMF for BernoulliBeta.
BayesianNonparametrics.logpostpred
— MethodLog PMF for MultinomialDirichlet.
BayesianNonparametrics.logpostpred
— MethodLog PMF for MultinomialDirichlet.
BayesianNonparametrics.logpostpred
— Methodlogpostpred(d::ConjugatePostDistribution, X)
Compute log posterior predictive.
BayesianNonparametrics.pointestimate
— Methodpoint_estimate(psm::Array{Float64, 2})
Find optimal partition which minimizes the lower bound to the Variation of Information obtain from Jensen's inequality where the expectation and log are reversed.
Code based on R implementation by Sara Wade <sara.wade@eng.cam.ac.uk>
BayesianNonparametrics.posteriorParameters
— MethodposteriorParameters(d::ConjugatePostDistribution)
Compute posterior distribution parameters.
BayesianNonparametrics.randomindex
— Methodrandomindex(p::Vector{Float64})
Randomly select an index propotional to its probability.
BayesianNonparametrics.remove!
— Methodremove!(d::ConjugatePostDistribution, X)
Remove data from Posterior Distribution (inplace).
BayesianNonparametrics.remove
— Methodremove(d::ConjugatePostDistribution, X::AbstractArray)
Remove data from Posterior Distribution.
BayesianNonparametrics.resampleα
— Methodresampleα(α::Float64, N::Int, K::Int)
Resample α given the approach by Escobar and West. (page 585)
BayesianNonparametrics.AbstractHyperparam
— Typeabstract Hyperparameters
BayesianNonparametrics.AbstractModelBuffer
— TypeAbstract Model Buffer Object
BayesianNonparametrics.AbstractModelData
— TypeAbstract Model Data Object
BayesianNonparametrics.HDPData
— TypeHierarchical Dirichlet Process Mixture Model Data Object
BayesianNonparametrics.gibbs!
— MethodSingle iteration of collabsed Gibbs sampling using CRP.
BayesianNonparametrics.gibbs!
— MethodSingle Gibbs sweep of HDP training using beta variables.
BayesianNonparametrics.isdistempty
— Methodisdistempty(d::ConjugatePostDistribution)
Check if distribution is empty (contains no samples).
BayesianNonparametrics.point_estimate_hclust
— Methodpoint_estimate_avg(psm::Array{Float64, 2})
Find optimal partition which minimizes the lower bound to the Variation of Information obtain from Jensen's inequality where the expectation and log are reversed.
Code based on R implementation by Sara Wade <sara.wade@eng.cam.ac.uk>
BayesianNonparametrics.tlogpdf
— MethodLog PDF of Generalized student-t Distribution.
BayesianNonparametrics.updateenergy!
— MethodCompute Energy of model for given data
BayesianNonparametrics.variation_of_information_lb
— Methodvariation_of_information_lb()
Computes the lower bound to the posterior expected Variation of Information.
BayesianNonparametrics.variation_of_information_lb
— Methodvariation_of_information_lb()
Computes the lower bound to the posterior expected Variation of Information.