@@ -62,22 +62,26 @@ def test_sample_gaussian():
62
62
mu = np .random .randint (10 ) * np .random .rand (n_features )
63
63
cv = (np .random .rand (n_features ) + 1.0 ) ** 2
64
64
65
- samples = mixture .sample_gaussian (mu , cv , cvtype = 'diag' , n = n_samples )
65
+ samples = mixture .sample_gaussian (
66
+ mu , cv , cvtype = 'diag' , n_samples = n_samples )
66
67
67
68
assert np .allclose (samples .mean (axis ), mu , atol = 0.3 )
68
69
assert np .allclose (samples .var (axis ), cv , atol = 0.5 )
69
70
70
71
# the same for spherical covariances
71
72
cv = (np .random .rand () + 1.0 ) ** 2
72
- samples = mixture .sample_gaussian (mu , cv , cvtype = 'spherical' , n = n_samples )
73
+ samples = mixture .sample_gaussian (
74
+ mu , cv , cvtype = 'spherical' , n_samples = n_samples )
73
75
74
76
assert np .allclose (samples .mean (axis ), mu , atol = 0.3 )
75
- assert np .allclose (samples .var (axis ), np .repeat (cv , n_features ), atol = 0.5 )
77
+ assert np .allclose (
78
+ samples .var (axis ), np .repeat (cv , n_features ), atol = 0.5 )
76
79
77
80
# and for full covariances
78
81
A = np .random .randn (n_features , n_features )
79
82
cv = np .dot (A .T , A ) + np .eye (n_features )
80
- samples = mixture .sample_gaussian (mu , cv , cvtype = 'full' , n = n_samples )
83
+ samples = mixture .sample_gaussian (
84
+ mu , cv , cvtype = 'full' , n_samples = n_samples )
81
85
assert np .allclose (samples .mean (axis ), mu , atol = 0.3 )
82
86
assert np .allclose (np .cov (samples ), cv , atol = 1. )
83
87
@@ -219,7 +223,7 @@ def test_train(self, params='wmc'):
219
223
g ._covars = 20 * self .covars [self .cvtype ]
220
224
221
225
# Create a training set by sampling from the predefined distribution.
222
- train_obs = g .rvs (n = 100 )
226
+ train_obs = g .rvs (n_samples = 100 )
223
227
224
228
g .fit (train_obs , n_iter = 0 , init_params = params )
225
229
0 commit comments