#NEWLINE# def _update_projected_gradient_h( X , W , H , tolH , nls_max_iter , alpha , l1_ratio , sparseness , beta , eta ) : #NEWLINE# #INDENT# 'Helper function for _fit_projected_gradient' #NEWLINE# ( n_samples , n_features ) = X . shape #NEWLINE# n_components_ = W . shape [ 1 ] #NEWLINE# if ( sparseness is None ) : #NEWLINE# #INDENT# ( H , gradH , iterH ) = _nls_subproblem ( X , W , H , tolH , nls_max_iter , alpha = alpha , l1_ratio = l1_ratio ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( sparseness == 'data' ) : #NEWLINE# #INDENT# ( H , gradH , iterH ) = _nls_subproblem ( safe_vstack ( [ X , np . zeros ( ( n_components_ , n_features ) ) ] ) , safe_vstack ( [ W , ( np . sqrt ( eta ) * np . eye ( n_components_ ) ) ] ) , H , tolH , nls_max_iter , alpha = alpha , l1_ratio = l1_ratio ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( sparseness == 'components' ) : #NEWLINE# #INDENT# ( H , gradH , iterH ) = _nls_subproblem ( safe_vstack ( [ X , np . zeros ( ( 1 , n_features ) ) ] ) , safe_vstack ( [ W , ( np . sqrt ( beta ) * np . ones ( ( 1 , n_components_ ) ) ) ] ) , H , tolH , nls_max_iter , alpha = alpha , l1_ratio = l1_ratio ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# return ( gradH , gradH , iterH )