空间中任意一点到超平面距离的公式推导
空间中任意一点$x_0$到超平面S的距离公式:
$ \frac {1} { ||w||} |w \bullet x_0 + b|$
推导过程:
取点空间中一点$x_0$,,超平面S:$w \bullet x + b = 0$,其中$x_0$,w,x均为N维向量;
设点$x_0$到平面S的距离为d,点$x_0$在平面S上的投影点为$x_1$,则$x_1$满足$w \bullet x_1 + b = 0$;
因为向量$\vec{x_0x_1}$平行于S平面的法向量w,故有
$|w \bullet \vec{x_0x_1}| = |w| |\vec{x_0x_1}| = \sqrt {(w^1)^2 + ... + (w^N)^2} d = ||w||d$,其中$||w||$为向量w的$L_2$范数;
又因 $w \bullet \sqrt{x_0x_1} = w^1(x_0^1 - x_1^1) + w^2(x_0^2 - x_1^2) + ... +w^N(x_0^N-x_1^N)$
$= w^1x_0^1 + w^2x_0^2 + ... + w^Nx_0^N - (w^1x_1^1 + w^2x_1^2 + ... + w^Nx_1^N)$
$= w^1x_0^1 + w^2x_0^2 + ... +w^Nx_0^2 - (-b)$
$= w \bullet x_0 + b$
故 $|w \bullet \vec{x_0x_1}| = |w \bullet x_0 + b| = ||w||d$
得$ d = \frac {1}{||w||} |w \bullet x_0 + b|$