Gaussian Mixture Model data generation

Hi,

I want to generate data from a Gaussian mixture model for using ADVI on it to test. I am following https://docs.pymc.io/notebooks/gaussian-mixture-model-advi.html 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?

Thanks

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.