简体   繁体   中英

How to fix the following error . TypeError: __init__() got an uexpected keyword argument 'n_iter'

from sklearn.mixture import GaussianMixture

gmm = GaussianMixture(
    n_components = 8, 
    n_iter = 200, 
    covariance_type='diag',
    n_init = 3
)

You need to give max_iter for number of EM iterations, instead of n_iter . n_iter is not valid parameter for GussianMixture model.

Doumentation

This should work:

from sklearn.mixture import GaussianMixture

gmm = GaussianMixture(
    n_components = 8, 
    max_iter = 200, 
    covariance_type='diag',
    n_init = 3
)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM