#NEWLINE# def test_safe_compute_error( ) : #NEWLINE# #INDENT# A = np . abs ( random_state . randn ( 10 , 10 ) ) #NEWLINE# A [ : , ( 2 * np . arange ( 5 ) ) ] = 0 #NEWLINE# A_sparse = csc_matrix ( A ) #NEWLINE# ( W , H ) = nmf . _initialize_nmf ( A , 5 , init = 'random' , random_state = 0 ) #NEWLINE# error = nmf . _safe_compute_error ( W , W , H ) #NEWLINE# error_sparse = nmf . _safe_compute_error ( A_sparse , W , H ) #NEWLINE# assert_almost_equal ( error , error_sparse )