KernelRegression
¶

class
numpy_ml.nonparametric.
KernelRegression
(kernel=None)[source]¶ A NadarayaWatson kernel regression model.
Notes
The NadarayaWatson regression model is
\[f(x) = \sum_i w_i(x) y_i\]where the sample weighting functions, \(w_i\), are simply
\[w_i(x) = \frac{k(x, x_i)}{\sum_j k(x, x_j)}\]with k being the kernel function.
Observe that knearest neighbors (
KNN
) regression is a special case of kernel regression where the k closest observations have a weight 1/k, and all others have weight 0.Parameters: kernel (str, Kernel object, or dict) – The kernel to use. If None, default to LinearKernel
. Default is None.