generate#
- MixtureModel.generate(size)[source]#
Generates random samples from the mixture model.
First, a component is chosen based on the mixture weights. Then, a sample is drawn from the chosen component’s distribution. This process is repeated size times.
- Parameters:
size (int) – The number of random samples to generate.
- Returns:
A NumPy array containing the generated samples. Returns an empty array if
sizeis not positive.- Return type:
NDArray[np.float64]