pub fn finite_difference_gradient<K: Kernel>(
kernel: &mut DeepKernel<MLPFeatureExtractor, K>,
x: &[f64],
y: &[f64],
h: f64,
) -> Result<Vec<f64>>Expand description
Numerical gradient ∂K_DKL/∂θ via central finite differences on the
flat parameter buffer. Returns a vector of length
kernel.feature_extractor().parameter_count().
The caller must pass an MLPFeatureExtractor (or any extractor that
shares the parameters / sync_from_flat contract) — the helper
needs to perturb the flat buffer and then push the update back into
the layer weights before the next forward pass.