Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cfc280d

Browse files
committed
switch to multinomial composition for mixture sampling
1 parent 2caa144 commit cfc280d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sklearn/mixture/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -385,7 +385,7 @@ def sample(self, n_samples=1):
385385

386386
_, n_features = self.means_.shape
387387
rng = check_random_state(self.random_state)
388-
n_samples_comp = np.round(self.weights_ * n_samples).astype(int)
388+
n_samples_comp = rng.multinomial(n_samples, self.weights_).astype(int)
389389

390390
if self.covariance_type == 'full':
391391
X = np.vstack([

0 commit comments

Comments
 (0)