统计学习中的Kernel Function
0.引入
假设随机变量 X X X来自某个未知分布 F ( X ) F(X) F(X) , 我们有一组 X X X的抽样观测: x 1 , . . . x n x_1,...x_n x1,...xn .
我们的问题是: 该如何估计它背后密度函数 f ( x ) f(x) f(x) ?
1. Kernel density estimation(无监督学习)
1.1思想
我们已经假设分布函数为 F ( x ) F(x) F(x) , 密度函数为 f ( x ) f(x) f(x).
估计 F ( x ) F(x) F(x)的朴素想法就是用样本的经验分布 F n ( x ) F_n(x) Fn(x)去估计 F ( x ) F(x) F(x),这是因为 根据格里文科定理,我们知道 当样本容量 n → ∞ n→∞ n→∞时, F n ( x ) F_n(x) Fn(x)以概率1 一致收敛于 F ( x ) F(x) F(x).
根据定义, F n ( x ) = 1 n ∑ i = 1 n I ( x i ≤ x ) F_n(x)=\frac{1}{n}\sum_{i=1}^nI(x_i\le x) Fn(x)=n1∑i=1nI(xi≤x)
下面考虑我们的估计目标 f ( x ) f(x) f(x) , 我们知道密度函数是分布函数的导数, 自然地我们有: f ( x ) = l i m h → 0 F ( x + h ) − F ( x − h ) 2 h f(x)=lim_{h\to 0 \frac{F(x+h)-F(x-h)}{2h} } f(x)=limh→02hF(x+h)−F(x−h)
将 F ( x ) F(x) F(x)的估计 F n ( x ) F_n(x) Fn(x)带入: f ( x ) ≈ F n ( x + h ) − F n ( x − h ) 2 h = 1 n ∑ i = 1 n I ( x − h ≤ x i ≤ x + h ) 2 h = 1 n ∑ i = 1 n 1 2 1 h I ( x − h ≤ x i ≤ x + h ) = 1 n ∑ i = 1 n 1 2 1 h I ( − 1 ≤ x i − x h ≤ 1 ) = 1 n ∑ i = 1 n 1 2 1 h I ( ∣ x i − x h ∣ ≤ 1 ) f(x)≈ \frac{F_n(x+h)-F_n(x-h)}{2h} =\frac{\frac{1}{n}\sum_{i=1}^nI(x-h\le xi\le x+h)}{2h}=\frac{1}{n}\sum_{i=1}^n\frac{1}{2}\frac{1}{h}I(x-h\le x_i \le x+h)=\frac{1}{n}\sum_{i=1}^n\frac{1}{2}\frac{1}{h}I(-1\le \frac{x_i-x}{h} \le 1)=\frac{1}{n}\sum_{i=1}^n\frac{1}{2}\frac{1}{h}I(|\frac{x_i-x}{h}| \le 1) f(x)≈2hFn(x+h)−Fn(x−h)=2hn1∑i=1nI(x−h≤xi≤x+h)=n1i=1∑n21h1I(x−h≤xi≤x+h)=n1i=1∑n21h1I(−1≤hxi−x≤1)=n1i=1