This is because in the expression:
dict((covar_type,GMM(n_components=num,
covariance_type=covar_type, init_params='wmc',n_init=1, n_iter=10)) for covar_type in covs for num in num_comp)
You use the same key covar_typefor all iterations, thereby rewriting the same element.
If we write the code in a more readable way, this is what happens:
data = dict()
for covar_type in covs:
for num in num_comp:
data[covar_type] = GMM(...)
, .
:
data = dict()
for covar_type in covs:
data[covar_type] = values = []
for num in num_comp:
values.append(GMM(...))
:
data = dict()
for covar_type in covs:
for num in num_comp:
data[(covar_type, num)] = GMM(...)