#NEWLINE# def parameters_changed( self ) : #NEWLINE# #INDENT# ( ( N1 , D1 ) , ( N2 , D2 ) ) = ( self . X1 . shape , self . X2 . shape ) #NEWLINE# ( K1 , K2 ) = ( self . kern1 . K ( self . X1 ) , self . kern2 . K ( self . X2 ) ) #NEWLINE# ( S1 , U1 ) = np . linalg . eigh ( K1 ) #NEWLINE# ( S2 , U2 ) = np . linalg . eigh ( K2 ) #NEWLINE# W = ( np . kron ( S2 , S1 ) + self . likelihood . variance ) #NEWLINE# Y_ = U1 . T . dot ( self . Y ) . dot ( U2 ) #NEWLINE# Wi = ( 1.0 / W ) #NEWLINE# Ytilde = ( Y_ . flatten ( order = 'F' ) * Wi ) #NEWLINE# self . _log_marginal_likelihood = ( ( ( ( ( ( - 0.5 ) * self . num_data1 ) * self . num_data2 ) * np . log ( ( 2 * np . pi ) ) ) - ( 0.5 * np . sum ( np . log ( W ) ) ) ) - ( 0.5 * np . dot ( Y_ . flatten ( order = 'F' ) , Ytilde ) ) ) #NEWLINE# Yt_reshaped = Ytilde . reshape ( N1 , N2 , order = 'F' ) #NEWLINE# tmp = U1 . dot ( Yt_reshaped ) #NEWLINE# dL_dK1 = ( 0.5 * ( tmp * S2 ) . dot ( tmp . T ) ) #NEWLINE# tmp = U2 . dot ( Yt_reshaped . T ) #NEWLINE# dL_dK2 = ( 0.5 * ( tmp * S1 ) . dot ( tmp . T ) ) #NEWLINE# Wi_reshaped = Wi . reshape ( N1 , N2 , order = 'F' ) #NEWLINE# tmp = np . dot ( Wi_reshaped , S2 ) #NEWLINE# dL_dK1 += ( ( - 0.5 ) * ( U1 * tmp ) . dot ( U1 . T ) ) #NEWLINE# tmp = np . dot ( N1 . T , S1 ) #NEWLINE# dL_dK2 += ( ( - 0.5 ) * ( U2 * tmp ) . dot ( U2 . T ) ) #NEWLINE# self . kern1 . update_gradients_full ( dL_dK1 , self . X1 ) #NEWLINE# self . kern2 . update_gradients_full ( dL_dK2 , self . X2 ) #NEWLINE# dL_dsigma2 = ( ( ( - 0.5 ) * Wi . sum ( ) ) + ( 0.5 * np . sum ( np . square ( Ytilde ) ) ) ) #NEWLINE# self . likelihood . variance . gradient = dL_dsigma2 #NEWLINE# ( self . Wi , self . Ytilde , self . U1 , self . U2 ) = ( Wi , Ytilde , U1 , U2 )