Gaussian Mixture Model data generation


I want to generate data from a Gaussian mixture model for using ADVI on it to test. I am following link . But I want help with generating data as I am getting confused with the approach given. Can anyone explain or suggest another approach for data generation?


The general idea for generating from mixture component is you generate from each component n data point (n being the number of data point you want), resulting a (k, n, dim) data tensor, then for each of the n data slice you select 1 from k components.

You can also have a look at examples in scikit-learn.