'Return the number of free parameters in the model.'

def _n_parameters(self):

    ndim = self.means_.shape[1]
    if (self.covariance_type == 'full'):
        cov_params = (((self.n_components * ndim) * (ndim + 1)) / 2.0)
    elif (self.covariance_type == 'diag'):
        cov_params = (self.n_components * ndim)
    elif (self.covariance_type == 'tied'):
        cov_params = ((ndim * (ndim + 1)) / 2.0)
    elif (self.covariance_type == 'spherical'):
        cov_params = self.n_components
    mean_params = (ndim * self.n_components)
    return int((((cov_params + mean_params) + self.n_components) - 1))
