In [1]:
using Plots
using Distributed
using LinearAlgebra
addprocs(2)
@everywhere using DPMMSubClusters
@everywhere using Random
┌ Info: Recompiling stale cache file /home/dinari/.julia/compiled/v1.2/DPMMSubClusters/9BX7d.ji for DPMMSubClusters [2841fd70-8698-11e9-176d-6dfa142d2ee7]
└ @ Base loading.jl:1240

Ploting Function

In [2]:
function plot_dp_2d(pts, labels)
    plt=Plots.plot()
    Plots.plot!(pts[1,:],pts[2,:], seriestype=:scatter, color = Int64.(labels), markersize = 3, markerstrokewidth = 0.5)
    return plt
end
Out[2]:
plot_dp_2d (generic function with 1 method)

Genereate data

10^5 Points, 2D, Generated from a 6 components Gaussian mixture model with components mean sampled from a normal distribution with isotropic variance scaled by 80.

In [3]:
Random.seed!(12345)
x,labels,clusters = generate_gaussian_data(10^4,2,6,80.0)
[1150, 2677, 599, 467, 1660, 3447]
Out[3]:
(Float32[-9.847014 -9.387273 … -2.5394673 -3.9460826; -1.9234223 -2.0801404 … -3.3766096 -3.2168627], Float32[1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0  …  6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0, 6.0], Float32[-10.154003 -1.3075126 … 8.33472 -2.6670465; -2.634079 8.442942 … -7.6152735 -2.953922], Float32[0.34564283 0.22069797; 0.22069797 0.32236543]

Float32[0.22681727 -0.004956623; -0.004956623 0.303323]

Float32[0.16988347 0.067502245; 0.067502245 0.50471747]

Float32[0.28009462 -0.019922389; -0.019922389 0.12439491]

Float32[1.7934563 -1.3593956; -1.3593956 1.2498971]

Float32[0.69099844 -0.038786825; -0.038786825 0.22402132])

Plot Data

In [4]:
plot_dp_2d(x, labels)
Out[4]:
-20 -10 0 10 -10 -5 0 5 10