#NEWLINE# def _n_parameters( self ) : #NEWLINE# #INDENT# 'Return the number of free parameters in the model.' #NEWLINE# ndim = self . means_ . shape [ 1 ] #NEWLINE# if ( self . covariance_type == 'full' ) : #NEWLINE# #INDENT# cov_params = ( ( ( self . n_components * ndim ) * ( ndim + 1 ) ) / 2.0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . covariance_type == 'diag' ) : #NEWLINE# #INDENT# cov_params = ( self . n_components * ndim ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . covariance_type == 'tied' ) : #NEWLINE# #INDENT# cov_params = ( ( ndim * ( ndim + 1 ) ) / 2.0 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( self . covariance_type == 'spherical' ) : #NEWLINE# #INDENT# cov_params = self . n_components #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# #UNINDENT# mean_params = ( ndim * self . n_components ) #NEWLINE# return int ( ( ( ( cov_params + mean_params ) + self . n_components ) - 1 ) )