Hi, 

Did you look into GaussianMixtures?  This has a random sampling function. 

---david

On Friday, December 19, 2014 1:42:38 PM UTC+1, Andreas Noack wrote:
>
> Hi Bradley
>
> I was able to construct an GMM instance with
>
> julia> Σnew = 
> Triangular{Float64,Matrix{Float64},:U,false}[chol(sigma[:,:,i], :U) for i = 
> 1:2]
>
> julia> GMM(p, mu, Σnew, [], 0)
> GMM{Float64} with 2 components in 2 dimensions and full covariance
> Mix 1: weight 0.900000
> mean: 1x2 Array{Float64,2}:
>  0.0  25.0
> covariance: 2x2 Array{Float64,2}:
>   5.26316  -4.73684
>  -4.73684   5.26316
> Mix 2: weight 0.100000
> mean: 1x2 Array{Float64,2}:
>  0.0  25.0
> covariance: 2x2 Array{Float64,2}:
>  0.133333  0.0     
>  0.0       0.133333
>
> but I don't understant the last two arguments to the constructor.
>
> 2014-12-18 1:06 GMT+01:00 Bradley Setzler <[email protected] 
> <javascript:>>:
> >
> > Hi,
> >
> > I wish to work with the Gaussian Mixture distribution (especially rand 
> and pdf), exactly as in this example: 
> >
> > mu = [0.0 25.0; 0.0 25.0] 
> > sigma = Array(Float64, 2, 2, 2) 
> > sigma[:, :, 1] = [1.0 0.9; 0.9 1.0] 
> > sigma[:, :, 2] = 7.5 * [1.0 0.0; 0.0 1.0] 
> > p = [0.9, 0.1] 
> >
> > distr = MixtureMultivariateNormals(mu, sigma, p) 
> > X = rand(distr, 10_000)
> >
> >
> > However, the method MixtureMultivariateNormals(mu, sigma, p) used in 
> that example no longer exists. The maintained version of MixtureModels.jl 
> has no examples or methods in the documentation of basic usage, and it is 
> far from obvious how to use it for a Gaussian mixture.
> >
> > Separately, the package GaussianMixtures.jl, does not successfully work 
> in what would seem to be the obvious method:
> >
> > julia> GMM(p,mu,sigma)
> > ERROR: `GMM{T<:FloatingPoint,CT<:Union(Array{T,2},Array{T,1})}` has no 
> method matching 
> GMM{T<:FloatingPoint,CT<:Union(Array{T,2},Array{T,1})}(::Array{Float64,1}, 
> ::Array{Float64,2}, ::Array{Float64,2})
> >
> > Could someone show me a working example analogous to the one above, 
> using whichever package you wish?
> >
> > Thank you,
> > Bradley
>

Reply via email to