22from sklearn .gaussian_process .kernels import Kernel , NormalizedKernelMixin , Hyperparameter
33
44
5- def _correlation (kernel , D , kernel_params = None ):
5+ def _spot_correlation (kernel , D , kernel_params = None ):
66 """
77 Dispatches to the selected kernel function.
88 Args:
@@ -49,7 +49,7 @@ def _correlation(kernel, D, kernel_params=None):
4949 raise ValueError (f"Unknown kernel: { kernel } " )
5050
5151
52- # Example: Custom sklearn-compatible RBF kernel using _correlation
52+ # Example: Custom sklearn-compatible RBF kernel using _spot_correlation
5353class CustomRBF (NormalizedKernelMixin , Kernel ):
5454 def __init__ (self , length_scale = 1.0 , length_scale_bounds = (1e-5 , 1e5 )):
5555 self .length_scale = length_scale
@@ -61,7 +61,7 @@ def hyperparameter_length_scale(self):
6161
6262 def __call__ (self , D , eval_gradient = False ):
6363 # D is assumed to be the squared distance matrix
64- K = _correlation ("gauss" , D )
64+ K = _spot_correlation ("gauss" , D )
6565 if eval_gradient :
6666 # Gradient not implemented
6767 return K , np .empty ((K .shape [0 ], K .shape [1 ], 0 ))
@@ -85,7 +85,7 @@ def hyperparameter_length_scale(self):
8585 return Hyperparameter ("length_scale" , "numeric" , self .length_scale_bounds )
8686
8787 def __call__ (self , D , eval_gradient = False ):
88- K = _correlation ("matern" , D , {"nu" : self .nu })
88+ K = _spot_correlation ("matern" , D , {"nu" : self .nu })
8989 if eval_gradient :
9090 # Gradient not implemented
9191 return K , np .empty ((K .shape [0 ], K .shape [1 ], 0 ))
0 commit comments