<s> from . kern import Kern <EOL> from ... core . parameterization import Param <EOL> from paramz . transformations import Logexp <EOL> import numpy as np <EOL> from . independent_outputs import index_to_slices <EOL> class ODE_UYC ( Kern ) : <EOL> def __init__ ( self , input_dim , variance_U = <NUM_LIT> , variance_Y = <NUM_LIT:1.> , lengthscale_U = <NUM_LIT:1.> , lengthscale_Y = <NUM_LIT:1.> , ubias = <NUM_LIT:1.> , active_dims = None , name = '<STR_LIT>' ) : <EOL> assert input_dim == <NUM_LIT:2> , "<STR_LIT>" <EOL> super ( ODE_UYC , self ) . __init__ ( input_dim , active_dims , name ) <EOL> self . variance_Y = Param ( '<STR_LIT>' , variance_Y , Logexp ( ) ) <EOL> self . variance_U = Param ( '<STR_LIT>' , variance_U , Logexp ( ) ) <EOL> self . lengthscale_Y = Param ( '<STR_LIT>' , lengthscale_Y , Logexp ( ) ) <EOL> self . lengthscale_U = Param ( '<STR_LIT>' , lengthscale_U , Logexp ( ) ) <EOL> self . ubias = Param ( '<STR_LIT>' , ubias , Logexp ( ) ) <EOL> self . link_parameters ( self . variance_Y , self . variance_U , self . lengthscale_Y , self . lengthscale_U , self . ubias ) <EOL> def K ( self , X , X2 = None ) : <EOL> X , slices = X [ : , : - <NUM_LIT:1> ] , index_to_slices ( X [ : , - <NUM_LIT:1> ] ) <EOL> if X2 is None : <EOL> X2 , slices2 = X , slices <EOL> K = np . zeros ( ( X . shape [ <NUM_LIT:0> ] , X . shape [ <NUM_LIT:0> ] ) ) <EOL> else : <EOL> X2 , slices2 = X2 [ : , : - <NUM_LIT:1> ] , index_to_slices ( X2 [ : , - <NUM_LIT:1> ] ) <EOL> K = np . zeros ( ( X . shape [ <NUM_LIT:0> ] , X2 . shape [ <NUM_LIT:0> ] ) ) <EOL> rdist = X - X2 . T <EOL> ly = <NUM_LIT:1> / self . lengthscale_Y <EOL> lu = np . sqrt ( <NUM_LIT:3> ) / self . lengthscale_U <EOL> Vu = self . variance_U <EOL> Vy = self . variance_Y <EOL> kuu = lambda dist : Vu * ( <NUM_LIT:1> + lu * np . abs ( dist ) ) * np . exp ( - lu * np . abs ( dist ) ) + self . ubias <EOL> k1 = lambda dist : np . exp ( - ly * np . abs ( dist ) ) * ( <NUM_LIT:2> * lu + ly ) / ( lu + ly ) ** <NUM_LIT:2> <EOL> k2 = lambda dist : ( np . exp ( - lu * dist ) * ( ly - <NUM_LIT:2> * lu + lu * ly * dist - lu ** <NUM_LIT:2> * dist ) + np . exp ( - ly * dist ) * ( <NUM_LIT:2> * lu - ly ) ) / ( ly - lu ) ** <NUM_LIT:2> <EOL> k3 = lambda dist : np . exp ( - lu * dist ) * ( ( <NUM_LIT:1> + lu * dist ) / ( lu + ly ) + ( lu ) / ( lu + ly ) ** <NUM_LIT:2> ) <EOL> kyy = lambda dist : Vu * Vy * ( k1 ( dist ) + k2 ( dist ) + k3 ( dist ) ) <EOL> kyu3 = lambda dist : np . exp ( - lu * dist ) / ( lu + ly ) * ( <NUM_LIT:1> + lu * ( dist + <NUM_LIT:1> / ( lu + ly ) ) ) <EOL> k1cros = lambda dist : np . exp ( ly * dist ) / ( lu - ly ) * ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * dist ) + lu * ( dist * np . exp ( ( lu - ly ) * dist ) + ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * dist ) ) / ( lu - ly ) ) ) <EOL> k2cros = lambda dist : np . exp ( ly * dist ) * ( <NUM_LIT:1> / ( lu + ly ) + lu / ( lu + ly ) ** <NUM_LIT:2> ) <EOL> Vyu = np . sqrt ( Vy * ly * <NUM_LIT:2> ) <EOL> kuyp = lambda dist : Vu * Vyu * ( kyu3 ( dist ) ) <EOL> kuyn = lambda dist : Vu * Vyu * ( k1cros ( dist ) + k2cros ( dist ) ) <EOL> kyup = lambda dist : Vu * Vyu * ( k1cros ( - dist ) + k2cros ( - dist ) ) <EOL> kyun = lambda dist : Vu * Vyu * ( kyu3 ( - dist ) ) <EOL> for i , s1 in enumerate ( slices ) : <EOL> for j , s2 in enumerate ( slices2 ) : <EOL> for ss1 in s1 : <EOL> for ss2 in s2 : <EOL> if i == <NUM_LIT:0> and j == <NUM_LIT:0> : <EOL> K [ ss1 , ss2 ] = kuu ( np . abs ( rdist [ ss1 , ss2 ] ) ) <EOL> elif i == <NUM_LIT:0> and j == <NUM_LIT:1> : <EOL> K [ ss1 , ss2 ] = np . where ( rdist [ ss1 , ss2 ] > <NUM_LIT:0> , kuyp ( rdist [ ss1 , ss2 ] ) , kuyn ( rdist [ ss1 , ss2 ] ) ) <EOL> elif i == <NUM_LIT:1> and j == <NUM_LIT:1> : <EOL> K [ ss1 , ss2 ] = kyy ( np . abs ( rdist [ ss1 , ss2 ] ) ) <EOL> else : <EOL> K [ ss1 , ss2 ] = np . where ( rdist [ ss1 , ss2 ] > <NUM_LIT:0> , kyup ( rdist [ ss1 , ss2 ] ) , kyun ( rdist [ ss1 , ss2 ] ) ) <EOL> return K <EOL> def Kdiag ( self , X ) : <EOL> """<STR_LIT>""" <EOL> Kdiag = np . zeros ( X . shape [ <NUM_LIT:0> ] ) <EOL> ly = <NUM_LIT:1> / self . lengthscale_Y <EOL> lu = np . sqrt ( <NUM_LIT:3> ) / self . lengthscale_U <EOL> Vu = self . variance_U <EOL> Vy = self . variance_Y <EOL> k1 = ( <NUM_LIT:2> * lu + ly ) / ( lu + ly ) ** <NUM_LIT:2> <EOL> k2 = ( ly - <NUM_LIT:2> * lu + <NUM_LIT:2> * lu - ly ) / ( ly - lu ) ** <NUM_LIT:2> <EOL> k3 = <NUM_LIT:1> / ( lu + ly ) + ( lu ) / ( lu + ly ) ** <NUM_LIT:2> <EOL> slices = index_to_slices ( X [ : , - <NUM_LIT:1> ] ) <EOL> for i , ss1 in enumerate ( slices ) : <EOL> for s1 in ss1 : <EOL> if i == <NUM_LIT:0> : <EOL> Kdiag [ s1 ] += self . variance_U + self . ubias <EOL> elif i == <NUM_LIT:1> : <EOL> Kdiag [ s1 ] += Vu * Vy * ( k1 + k2 + k3 ) <EOL> else : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> return Kdiag <EOL> def update_gradients_full ( self , dL_dK , X , X2 = None ) : <EOL> """<STR_LIT>""" <EOL> X , slices = X [ : , : - <NUM_LIT:1> ] , index_to_slices ( X [ : , - <NUM_LIT:1> ] ) <EOL> if X2 is None : <EOL> X2 , slices2 = X , slices <EOL> else : <EOL> X2 , slices2 = X2 [ : , : - <NUM_LIT:1> ] , index_to_slices ( X2 [ : , - <NUM_LIT:1> ] ) <EOL> rdist = X - X2 . T <EOL> ly = <NUM_LIT:1> / self . lengthscale_Y <EOL> lu = np . sqrt ( <NUM_LIT:3> ) / self . lengthscale_U <EOL> Vu = self . variance_U <EOL> Vy = self . variance_Y <EOL> Vyu = np . sqrt ( Vy * ly * <NUM_LIT:2> ) <EOL> dVdly = <NUM_LIT:0.5> / np . sqrt ( ly ) * np . sqrt ( <NUM_LIT:2> * Vy ) <EOL> dVdVy = <NUM_LIT:0.5> / np . sqrt ( Vy ) * np . sqrt ( <NUM_LIT:2> * ly ) <EOL> rd = rdist . shape [ <NUM_LIT:0> ] <EOL> dktheta1 = np . zeros ( [ rd , rd ] ) <EOL> dktheta2 = np . zeros ( [ rd , rd ] ) <EOL> dkUdvar = np . zeros ( [ rd , rd ] ) <EOL> dkYdvar = np . zeros ( [ rd , rd ] ) <EOL> dkdubias = np . zeros ( [ rd , rd ] ) <EOL> UUdtheta1 = lambda dist : np . exp ( - lu * dist ) * dist + ( - dist ) * np . exp ( - lu * dist ) * ( <NUM_LIT:1> + lu * dist ) <EOL> UUdtheta2 = lambda dist : <NUM_LIT:0> <EOL> UUdvar = lambda dist : ( <NUM_LIT:1> + lu * np . abs ( dist ) ) * np . exp ( - lu * np . abs ( dist ) ) <EOL> dk1theta1 = lambda dist : np . exp ( - ly * dist ) * <NUM_LIT:2> * ( - lu ) / ( lu + ly ) ** <NUM_LIT:3> <EOL> dk2theta1 = lambda dist : ( <NUM_LIT:1.0> ) * ( <EOL> np . exp ( - lu * dist ) * dist * ( - ly + <NUM_LIT:2> * lu - lu * ly * dist + dist * lu ** <NUM_LIT:2> ) * ( ly - lu ) ** ( - <NUM_LIT:2> ) + np . exp ( - lu * dist ) * ( - <NUM_LIT:2> + ly * dist - <NUM_LIT:2> * dist * lu ) * ( ly - lu ) ** ( - <NUM_LIT:2> ) <EOL> + np . exp ( - dist * lu ) * ( ly - <NUM_LIT:2> * lu + ly * lu * dist - dist * lu ** <NUM_LIT:2> ) * <NUM_LIT:2> * ( ly - lu ) ** ( - <NUM_LIT:3> ) <EOL> + np . exp ( - dist * ly ) * <NUM_LIT:2> * ( ly - lu ) ** ( - <NUM_LIT:2> ) <EOL> + np . exp ( - dist * ly ) * <NUM_LIT:2> * ( <NUM_LIT:2> * lu - ly ) * ( ly - lu ) ** ( - <NUM_LIT:3> ) <EOL> ) <EOL> dk3theta1 = lambda dist : np . exp ( - dist * lu ) * ( lu + ly ) ** ( - <NUM_LIT:2> ) * ( ( <NUM_LIT:2> * lu + ly + dist * lu ** <NUM_LIT:2> + lu * ly * dist ) * ( - dist - <NUM_LIT:2> / ( lu + ly ) ) + <NUM_LIT:2> + <NUM_LIT:2> * lu * dist + ly * dist ) <EOL> dk1theta2 = lambda dist : np . exp ( - ly * dist ) * ( ( lu + ly ) ** ( - <NUM_LIT:2> ) ) * ( ( - dist ) * ( <NUM_LIT:2> * lu + ly ) + <NUM_LIT:1> + ( - <NUM_LIT:2> ) * ( <NUM_LIT:2> * lu + ly ) / ( lu + ly ) ) <EOL> dk2theta2 = lambda dist : <NUM_LIT:1> * ( <EOL> np . exp ( - dist * lu ) * ( ly - lu ) ** ( - <NUM_LIT:2> ) * ( <NUM_LIT:1> + lu * dist + ( - <NUM_LIT:2> ) * ( ly - <NUM_LIT:2> * lu + lu * ly * dist - dist * lu ** <NUM_LIT:2> ) * ( ly - lu ) ** ( - <NUM_LIT:1> ) ) <EOL> + np . exp ( - dist * ly ) * ( ly - lu ) ** ( - <NUM_LIT:2> ) * ( ( - dist ) * ( <NUM_LIT:2> * lu - ly ) - <NUM_LIT:1> + ( <NUM_LIT:2> * lu - ly ) * ( - <NUM_LIT:2> ) * ( ly - lu ) ** ( - <NUM_LIT:1> ) ) <EOL> ) <EOL> dk3theta2 = lambda dist : np . exp ( - dist * lu ) * ( - <NUM_LIT:3> * lu - ly - dist * lu ** <NUM_LIT:2> - lu * ly * dist ) / ( lu + ly ) ** <NUM_LIT:3> <EOL> k1 = lambda dist : np . exp ( - ly * dist ) * ( <NUM_LIT:2> * lu + ly ) / ( lu + ly ) ** <NUM_LIT:2> <EOL> k2 = lambda dist : ( np . exp ( - lu * dist ) * ( ly - <NUM_LIT:2> * lu + lu * ly * dist - lu ** <NUM_LIT:2> * dist ) + np . exp ( - ly * dist ) * ( <NUM_LIT:2> * lu - ly ) ) / ( ly - lu ) ** <NUM_LIT:2> <EOL> k3 = lambda dist : np . exp ( - lu * dist ) * ( ( <NUM_LIT:1> + lu * dist ) / ( lu + ly ) + ( lu ) / ( lu + ly ) ** <NUM_LIT:2> ) <EOL> kyu3 = lambda dist : np . exp ( - lu * dist ) / ( lu + ly ) * ( <NUM_LIT:1> + lu * ( dist + <NUM_LIT:1> / ( lu + ly ) ) ) <EOL> k1cros = lambda dist : np . exp ( ly * dist ) / ( lu - ly ) * ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * dist ) + lu * ( dist * np . exp ( ( lu - ly ) * dist ) + ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * dist ) ) / ( lu - ly ) ) ) <EOL> k2cros = lambda dist : np . exp ( ly * dist ) * ( <NUM_LIT:1> / ( lu + ly ) + lu / ( lu + ly ) ** <NUM_LIT:2> ) <EOL> kuyp = lambda dist : ( kyu3 ( dist ) ) <EOL> kuyn = lambda dist : ( k1cros ( dist ) + k2cros ( dist ) ) <EOL> kyup = lambda dist : ( k1cros ( - dist ) + k2cros ( - dist ) ) <EOL> kyun = lambda dist : ( kyu3 ( - dist ) ) <EOL> dkyu3dtheta2 = lambda dist : np . exp ( - lu * dist ) * ( ( - <NUM_LIT:1> ) * ( lu + ly ) ** ( - <NUM_LIT:2> ) * ( <NUM_LIT:1> + lu * dist + lu * ( lu + ly ) ** ( - <NUM_LIT:1> ) ) + ( lu + ly ) ** ( - <NUM_LIT:1> ) * ( - lu ) * ( lu + ly ) ** ( - <NUM_LIT:2> ) ) <EOL> dkyu3dtheta1 = lambda dist : np . exp ( - lu * dist ) * ( lu + ly ) ** ( - <NUM_LIT:1> ) * ( ( - dist ) * ( <NUM_LIT:1> + dist * lu + lu * ( lu + ly ) ** ( - <NUM_LIT:1> ) ) - ( lu + ly ) ** ( - <NUM_LIT:1> ) * ( <NUM_LIT:1> + dist * lu + lu * ( lu + ly ) ** ( - <NUM_LIT:1> ) ) + dist + ( lu + ly ) ** ( - <NUM_LIT:1> ) - lu * ( lu + ly ) ** ( - <NUM_LIT:2> ) ) <EOL> dkcros2dtheta1 = lambda dist : np . exp ( ly * dist ) * ( - ( ly + lu ) ** ( - <NUM_LIT:2> ) + ( ly + lu ) ** ( - <NUM_LIT:2> ) + ( - <NUM_LIT:2> ) * lu * ( lu + ly ) ** ( - <NUM_LIT:3> ) ) <EOL> dkcros2dtheta2 = lambda dist : np . exp ( ly * dist ) * dist * ( ( ly + lu ) ** ( - <NUM_LIT:1> ) + lu * ( lu + ly ) ** ( - <NUM_LIT:2> ) ) + np . exp ( ly * dist ) * ( - ( lu + ly ) ** ( - <NUM_LIT:2> ) + lu * ( - <NUM_LIT:2> ) * ( lu + ly ) ** ( - <NUM_LIT:3> ) ) <EOL> dkcros1dtheta1 = lambda dist : np . exp ( ly * dist ) * ( - ( lu - ly ) ** ( - <NUM_LIT:2> ) * ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * dist ) + lu * dist * np . exp ( ( lu - ly ) * dist ) + lu * ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * dist ) ) / ( lu - ly ) ) + ( lu - ly ) ** ( - <NUM_LIT:1> ) * ( - np . exp ( ( lu - ly ) * dist ) * dist + dist * np . exp ( ( lu - ly ) * dist ) + lu * dist ** <NUM_LIT:2> * np . exp ( ( lu - ly ) * dist ) + ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * dist ) ) / ( lu - ly ) - lu * np . exp ( ( lu - ly ) * dist ) * dist / ( lu - ly ) - lu * ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * dist ) ) / ( lu - ly ) ** <NUM_LIT:2> ) ) <EOL> dkcros1dtheta2 = lambda t : np . exp ( ly * t ) * t / ( lu - ly ) * ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * t ) + lu * t * np . exp ( ( lu - ly ) * t ) + lu * ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * t ) ) / ( lu - ly ) ) + np . exp ( ly * t ) / ( lu - ly ) ** <NUM_LIT:2> * ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * t ) + lu * t * np . exp ( ( lu - ly ) * t ) + lu * ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * t ) ) / ( lu - ly ) ) + np . exp ( ly * t ) / ( lu - ly ) * ( np . exp ( ( lu - ly ) * t ) * t - lu * t * t * np . exp ( ( lu - ly ) * t ) + lu * t * np . exp ( ( lu - ly ) * t ) / ( lu - ly ) + lu * ( <NUM_LIT:1> - np . exp ( ( lu - ly ) * t ) ) / ( lu - ly ) ** <NUM_LIT:2> ) <EOL> dkuypdtheta1 = lambda dist : ( dkyu3dtheta1 ( dist ) ) <EOL> dkuyndtheta1 = lambda dist : ( dkcros1dtheta1 ( dist ) + dkcros2dtheta1 ( dist ) ) <EOL> dkyupdtheta1 = lambda dist : ( dkcros1dtheta1 ( - dist ) + dkcros2dtheta1 ( - dist ) ) <EOL> dkyundtheta1 = lambda dist : ( dkyu3dtheta1 ( - dist ) ) <EOL> dkuypdtheta2 = lambda dist : ( dkyu3dtheta2 ( dist ) ) <EOL> dkuyndtheta2 = lambda dist : ( dkcros1dtheta2 ( dist ) + dkcros2dtheta2 ( dist ) ) <EOL> dkyupdtheta2 = lambda dist : ( dkcros1dtheta2 ( - dist ) + dkcros2dtheta2 ( - dist ) ) <EOL> dkyundtheta2 = lambda dist : ( dkyu3dtheta2 ( - dist ) ) <EOL> for i , s1 in enumerate ( slices ) : <EOL> for j , s2 in enumerate ( slices2 ) : <EOL> for ss1 in s1 : <EOL> for ss2 in s2 : <EOL> if i == <NUM_LIT:0> and j == <NUM_LIT:0> : <EOL> dktheta1 [ ss1 , ss2 ] = Vu * UUdtheta1 ( np . abs ( rdist [ ss1 , ss2 ] ) ) <EOL> dktheta2 [ ss1 , ss2 ] = <NUM_LIT:0> <EOL> dkUdvar [ ss1 , ss2 ] = UUdvar ( np . abs ( rdist [ ss1 , ss2 ] ) ) <EOL> dkYdvar [ ss1 , ss2 ] = <NUM_LIT:0> <EOL> dkdubias [ ss1 , ss2 ] = <NUM_LIT:1> <EOL> elif i == <NUM_LIT:0> and j == <NUM_LIT:1> : <EOL> dktheta1 [ ss1 , ss2 ] = np . where ( rdist [ ss1 , ss2 ] > <NUM_LIT:0> , Vu * Vyu * dkuypdtheta1 ( rdist [ ss1 , ss2 ] ) , Vu * Vyu * dkuyndtheta1 ( rdist [ ss1 , ss2 ] ) ) <EOL> dkUdvar [ ss1 , ss2 ] = np . where ( rdist [ ss1 , ss2 ] > <NUM_LIT:0> , Vyu * kuyp ( rdist [ ss1 , ss2 ] ) , Vyu * kuyn ( rdist [ ss1 , ss2 ] ) ) <EOL> dktheta2 [ ss1 , ss2 ] = np . where ( rdist [ ss1 , ss2 ] > <NUM_LIT:0> , Vu * Vyu * dkuypdtheta2 ( rdist [ ss1 , ss2 ] ) + Vu * dVdly * kuyp ( rdist [ ss1 , ss2 ] ) , Vu * Vyu * dkuyndtheta2 ( rdist [ ss1 , ss2 ] ) + Vu * dVdly * kuyn ( rdist [ ss1 , ss2 ] ) ) <EOL> dkYdvar [ ss1 , ss2 ] = np . where ( rdist [ ss1 , ss2 ] > <NUM_LIT:0> , Vu * dVdVy * kuyp ( rdist [ ss1 , ss2 ] ) , Vu * dVdVy * kuyn ( rdist [ ss1 , ss2 ] ) ) <EOL> dkdubias [ ss1 , ss2 ] = <NUM_LIT:0> <EOL> elif i == <NUM_LIT:1> and j == <NUM_LIT:1> : <EOL> dktheta1 [ ss1 , ss2 ] = self . variance_U * self . variance_Y * ( dk1theta1 ( np . abs ( rdist [ ss1 , ss2 ] ) ) + dk2theta1 ( np . abs ( rdist [ ss1 , ss2 ] ) ) + dk3theta1 ( np . abs ( rdist [ ss1 , ss2 ] ) ) ) <EOL> dktheta2 [ ss1 , ss2 ] = self . variance_U * self . variance_Y * ( dk1theta2 ( np . abs ( rdist [ ss1 , ss2 ] ) ) + dk2theta2 ( np . abs ( rdist [ ss1 , ss2 ] ) ) + dk3theta2 ( np . abs ( rdist [ ss1 , ss2 ] ) ) ) <EOL> dkUdvar [ ss1 , ss2 ] = self . variance_Y * ( k1 ( np . abs ( rdist [ ss1 , ss2 ] ) ) + k2 ( np . abs ( rdist [ ss1 , ss2 ] ) ) + k3 ( np . abs ( rdist [ ss1 , ss2 ] ) ) ) <EOL> dkYdvar [ ss1 , ss2 ] = self . variance_U * ( k1 ( np . abs ( rdist [ ss1 , ss2 ] ) ) + k2 ( np . abs ( rdist [ ss1 , ss2 ] ) ) + k3 ( np . abs ( rdist [ ss1 , ss2 ] ) ) ) <EOL> dkdubias [ ss1 , ss2 ] = <NUM_LIT:0> <EOL> else : <EOL> dktheta1 [ ss1 , ss2 ] = np . where ( rdist [ ss1 , ss2 ] > <NUM_LIT:0> , Vu * Vyu * dkyupdtheta1 ( rdist [ ss1 , ss2 ] ) , Vu * Vyu * dkyundtheta1 ( rdist [ ss1 , ss2 ] ) ) <EOL> dkUdvar [ ss1 , ss2 ] = np . where ( rdist [ ss1 , ss2 ] > <NUM_LIT:0> , Vyu * kyup ( rdist [ ss1 , ss2 ] ) , Vyu * kyun ( rdist [ ss1 , ss2 ] ) ) <EOL> dktheta2 [ ss1 , ss2 ] = np . where ( rdist [ ss1 , ss2 ] > <NUM_LIT:0> , Vu * Vyu * dkyupdtheta2 ( rdist [ ss1 , ss2 ] ) + Vu * dVdly * kyup ( rdist [ ss1 , ss2 ] ) , Vu * Vyu * dkyundtheta2 ( rdist [ ss1 , ss2 ] ) + Vu * dVdly * kyun ( rdist [ ss1 , ss2 ] ) ) <EOL> dkYdvar [ ss1 , ss2 ] = np . where ( rdist [ ss1 , ss2 ] > <NUM_LIT:0> , Vu * dVdVy * kyup ( rdist [ ss1 , ss2 ] ) , Vu * dVdVy * kyun ( rdist [ ss1 , ss2 ] ) ) <EOL> dkdubias [ ss1 , ss2 ] = <NUM_LIT:0> <EOL> self . variance_U . gradient = np . sum ( dkUdvar * dL_dK ) <EOL> self . variance_Y . gradient = np . sum ( dkYdvar * dL_dK ) <EOL> self . lengthscale_U . gradient = np . sum ( dktheta1 * ( - np . sqrt ( <NUM_LIT:3> ) * self . lengthscale_U ** ( - <NUM_LIT:2> ) ) * dL_dK ) <EOL> self . lengthscale_Y . gradient = np . sum ( dktheta2 * ( - self . lengthscale_Y ** ( - <NUM_LIT:2> ) ) * dL_dK ) <EOL> self . ubias . gradient = np . sum ( dkdubias * dL_dK ) </s>
