kr_predict#

cbclib.bin.kr_predict(y: numpy.ndarray, x: numpy.ndarray, x_hat: numpy.ndarray, sigma: float, w: Optional[numpy.ndarray] = None, num_threads: int = 1)[source]#

Perform the multi-dimensional Nadaraya-Watson kernel regression [KerReg].

Parameters
  • y (numpy.ndarray) – The data to fit.

  • x (numpy.ndarray) – Coordinates array.

  • x_hat (numpy.ndarray) – Set of coordinates where the fit is to be calculated.

  • sigma (float) – Kernel bandwidth.

  • w (Optional[numpy.ndarray]) – A set of weights, unitary weights are assumed if it’s not provided.

  • num_threads (int) – Number of threads used in the calculations.

Returns

The regression result.

Raises
  • ValueError – If x and x_hat have incompatible shapes.

  • ValueError – If x and y have incompatible shapes.

Return type

numpy.ndarray

References

KerReg

E. A. Nadaraya, “On estimating regression,” Theory Probab. & Its Appl. 9, 141-142 (1964).