kr_grid#

cbclib.bin.kr_grid(y: numpy.ndarray, x: numpy.ndarray, grid: Tuple[numpy.ndarray, Ellipsis], sigma: float, w: Optional[numpy.ndarray] = None, return_roi: bool = True, num_threads: int = 1)[source]#

Perform the multi-dimensional Nadaraya-Watson kernel regression [KerReg] over a grid of points.

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

  • x (numpy.ndarray) – Coordinates array.

  • step – Grid sampling interval.

  • sigma (float) – Kernel bandwidth.

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

  • return_roi (bool) – Return region of interest of the sampling grid if True.

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

Raises

ValueError – If step is negative.

Returns

The regression result and the region of interest if return_roi is True.

Return type

Tuple[numpy.ndarray, numpy.ndarray]