#NEWLINE# def _compute( self , data_1 , data_2 ) : #NEWLINE# #INDENT# self . _dim = data_1 . shape [ 1 ] #NEWLINE# norm_1 = np . sqrt ( ( data_1 ** 2 ) . sum ( axis = 1 ) ) . reshape ( data_1 . shape [ 0 ] , 1 ) #NEWLINE# norm_2 = np . sqrt ( ( data_2 ** 2 ) . sum ( axis = 1 ) ) . reshape ( data_2 . shape [ 0 ] , 1 ) #NEWLINE# return ( data_1 . dot ( data_2 . T ) / ( norm_1 * norm_1 . T ) )