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