# Comparing Manual and PYMC ExpQuad Kernel Function : DIFFERENT RESULTS

Hi all;
I am trying to explore Pymc’s Gp class.

and I am having a hard time replicating Mclearth’s estimates from Gaussian Process (island example).
As I believe that using PYMC’s expEquad kernel function (below equation) is providing different estimates than when calculated manually, which led to loss in precision.

This is ExpEquad kernel function which I am trying to replicate…

# Dmat is some Distance Matrix ; source link below
ls=1 ## lets assume ls be 1
np.round(gp_object.full(X=Dmat).eval(),2)

array([[1.  , 0.89, 0.82, 0.  , 0.47, 0.13, 0.01, 0.02, 0.18, 0.  ],
[0.89, 1.  , 0.99, 0.  , 0.75, 0.3 , 0.03, 0.07, 0.38, 0.  ],
[0.82, 0.99, 1.  , 0.  , 0.83, 0.37, 0.04, 0.1 , 0.47, 0.  ],
[0.  , 0.  , 0.  , 1.  , 0.01, 0.07, 0.5 , 0.29, 0.04, 0.42],
[0.47, 0.75, 0.83, 0.01, 1.  , 0.72, 0.15, 0.3 , 0.82, 0.  ],
[0.13, 0.3 , 0.37, 0.07, 0.72, 1.  , 0.52, 0.75, 0.98, 0.  ],
[0.01, 0.03, 0.04, 0.5 , 0.15, 0.52, 1.  , 0.93, 0.42, 0.04],
[0.02, 0.07, 0.1 , 0.29, 0.3 , 0.75, 0.93, 1.  , 0.65, 0.02],
[0.18, 0.38, 0.47, 0.04, 0.82, 0.98, 0.42, 0.65, 1.  , 0.  ],
[0.  , 0.  , 0.  , 0.42, 0.  , 0.  , 0.04, 0.02, 0.  , 1.  ]])

Calculating manually

ls=1 # lets ls=1 for this too
Dmatsq=np.power(Dmat,2)
np.round(np.exp(-0.5*Dmatsq/ls),2)

array([[1.  , 0.89, 0.82, 0.  , 0.47, 0.13, 0.01, 0.02, 0.18, 0.  ],
[0.89, 1.  , 0.95, 0.  , 0.47, 0.13, 0.02, 0.03, 0.15, 0.  ],
[0.82, 0.95, 1.  , 0.  , 0.3 , 0.23, 0.04, 0.06, 0.07, 0.  ],
[0.  , 0.  , 0.  , 1.  , 0.  , 0.05, 0.3 , 0.27, 0.  , 0.  ],
[0.47, 0.47, 0.3 , 0.  , 1.  , 0.01, 0.  , 0.  , 0.75, 0.  ],
[0.13, 0.13, 0.23, 0.05, 0.01, 1.  , 0.2 , 0.7 , 0.  , 0.  ],
[0.01, 0.02, 0.04, 0.3 , 0.  , 0.2 , 1.  , 0.48, 0.  , 0.  ],
[0.02, 0.03, 0.06, 0.27, 0.  , 0.7 , 0.48, 1.  , 0.  , 0.  ],
[0.18, 0.15, 0.07, 0.  , 0.75, 0.  , 0.  , 0.  , 1.  , 0.  ],
[0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 0.  , 1.  ]])

NOTE: When comparing the first row and column these Matrices, they appear to be identical, but as we move away from these initial positions and examine other rows and columns, we can see that the values start to differ.

Should this be an issue? Or Did I mis-specify something here?