@@ -196,8 +196,9 @@ class GMM(BaseEstimator):
196196 >>> obs = np.concatenate((np.random.randn(100, 1),
197197 ... 10 + np.random.randn(300, 1)))
198198 >>> g.fit(obs) # doctest: +NORMALIZE_WHITESPACE
199- GMM(covariance_type=None, init_params='wmc', min_covar=0.001, n_components=2,
200- n_init=1, n_iter=100, params='wmc', random_state=None, thresh=0.01)
199+ GMM(covariance_type=None, init_params='wmc', min_covar=0.001,
200+ n_components=2, n_init=1, n_iter=100, params='wmc',
201+ random_state=None, thresh=0.01)
201202 >>> np.round(g.weights_, 2)
202203 array([ 0.75, 0.25])
203204 >>> np.round(g.means_, 2)
@@ -213,8 +214,9 @@ class GMM(BaseEstimator):
213214 >>> # Refit the model on new data (initial parameters remain the
214215 >>> # same), this time with an even split between the two modes.
215216 >>> g.fit(20 * [[0]] + 20 * [[10]]) # doctest: +NORMALIZE_WHITESPACE
216- GMM(covariance_type=None, init_params='wmc', min_covar=0.001, n_components=2,
217- n_init=1, n_iter=100, params='wmc', random_state=None, thresh=0.01)
217+ GMM(covariance_type=None, init_params='wmc', min_covar=0.001,
218+ n_components=2, n_init=1, n_iter=100, params='wmc',
219+ random_state=None, thresh=0.01)
218220 >>> np.round(g.weights_, 2)
219221 array([ 0.5, 0.5])
220222
@@ -435,15 +437,15 @@ def fit(self, X, **kwargs):
435437
436438 A initialization step is performed before entering the em
437439 algorithm. If you want to avoid this step, set the keyword
438- argument init_params to the empty string '' when creating the
439- GMM object. Likewise, if you would like just to do an
440+ argument init_params to the empty string '' when creating the
441+ GMM object. Likewise, if you would like just to do an
440442 initialization, set n_iter=0.
441443
442444 Parameters
443445 ----------
444446 X : array_like, shape (n, n_features)
445447 List of n_features-dimensional data points. Each row
446- corresponds to a single data point.
448+ corresponds to a single data point.
447449 """
448450 ## initialization step
449451 X = np .asarray (X )
@@ -454,13 +456,13 @@ def fit(self, X, **kwargs):
454456 'GMM estimation with %s components, but got only %s samples' %
455457 (self .n_components , X .shape [0 ]))
456458 if kwargs :
457- warnings .warn ("Setting parameters in the 'fit' method is deprecated "
458- "Set it on initialization instead." ,
459+ warnings .warn ("Setting parameters in the 'fit' method is"
460+ "deprecated. Set it on initialization instead." ,
459461 DeprecationWarning )
460462 # initialisations for in case the user still adds parameters to fit
461463 # so things don't break
462464 if 'n_iter' in kwargs :
463- self .n_iter = kwargs ['n_iter' ]
465+ self .n_iter = kwargs ['n_iter' ]
464466 if 'n_init' in kwargs :
465467 if kwargs ['n_init' ] < 1 :
466468 raise ValueError ('GMM estimation requires at least one run' )
@@ -470,7 +472,6 @@ def fit(self, X, **kwargs):
470472 self .params = kwargs ['params' ]
471473 if 'init_params' in kwargs :
472474 self .init_params = kwargs ['init_params' ]
473-
474475
475476 max_log_prob = - np .infty
476477
0 commit comments