#NEWLINE# def _check_covariances( covariances , covariance_type , n_components , n_features ) : #NEWLINE# #INDENT# "Validate user provided covariances.\n\n    Parameters\n    ----------\n    covariances : array-like,\n        'full' : shape of (n_components, n_features, n_features)\n        'tied' : shape of (n_features, n_features)\n        'diag' : shape of (n_components, n_features)\n        'spherical' : shape of (n_components,)\n\n    covariance_type : string\n\n    n_components : int\n        Number of components.\n\n    n_features : int\n        Number of features.\n\n    Returns\n    -------\n    covariances : array\n    " #NEWLINE# covariances = check_array ( n_features , dtype = [ np . float64 , np . float32 ] , ensure_2d = False , allow_nd = ( covariance_type is 'full' ) ) #NEWLINE# covariances_shape = { #NEWLINE# #INDENT# 'full' : ( n_components , n_features , n_features ) , #NEWLINE# 'tied' : ( n_features , n_features ) , #NEWLINE# 'diag' : ( n_components , n_features ) , #NEWLINE# 'spherical' : ( n_components , ) , #NEWLINE# #UNINDENT# } #NEWLINE# _check_shape ( covariances , covariances_shape [ covariance_type ] , ( '%s covariance' % covariance_type ) ) #NEWLINE# check_functions = { #NEWLINE# #INDENT# 'full' : _check_covariances_full , #NEWLINE# 'tied' : _check_covariance_matrix , #NEWLINE# 'diag' : _check_covariance_positivity , #NEWLINE# 'spherical' : _check_covariance_positivity , #NEWLINE# #UNINDENT# } #NEWLINE# check_functions [ covariance_type ] ( covariances , covariance_type ) #NEWLINE# return covariances