Goal: Define a fine kernel active only over the anterior rim of the fibula shaft, the scale is based on the distance from the closest point of a set of points along the anterior rim.
Problem: The low-rank GP computation for this custom kernel is extremely slow, not completing overnight.
Reference mesh: 8346 points
Precomputed scales: 1864 points with non-zero scale
Kernel Definition:
val fibulaKernel = new MatrixValuedPDKernel[_3D]() {
val rimKernel = DiagonalKernel3D(GaussianKernel3D(10) * 30.0)
def k(x: Point[_3D], y: Point[_3D]): DenseMatrix[Double] = {
val scaleX = precomputedScales.getOrElse(x, 0.0)
val scaleY = precomputedScales.getOrElse(y, 0.0)
if (scaleX == 0.0 || scaleY == 0.0) {
DenseMatrix.zeros[Double](3, 3)
} else {
rimKernel(x, y) * scaleX * scaleY
}
}
override def domain = EuclideanSpace[_3D]
override val outputDim = 3
}
precomputedScales is a map containing only the non-zero scales.
The computation of the GP is quick. I have tried both the Nystrom method with a few points and the Cholesky method with a high relative tolerance and the NearestNeighborInterpolator. However, it doesn't compute even overnight. Interestingly, if I define the same kernel over the entire mesh, the computation is really quick.
Does anyone know how to mitigate this issue? My linear algebra skills aren't the strongest, and I would appreciate any advice or suggestions on how to improve the performance of the low-rank GP computation.
Thanks in advance and kind regards,
Sybren van Rijn