On a measure of similarity between two hyperplanes Let $H_1$, $H_2$ be two hyperplanes of $\Bbb{R}^n$. Their normal vectors and bias terms are, respectively, given by $\mathbf{w}_1$, $\mathbf{w}_2$, $b_1$, and $b_2$. That is, they are given as
$$H_1: \mathbf{w}_1^\top\mathbf{x}+b_1=0
$$
and
$$
H_2: \mathbf{w}_2^\top\mathbf{x}+b_2=0.
$$
I am looking for a way of "comparing" the above hyperplanes. More specifically, I need to quantify their similarity using some function of their parameters ($\mathbf{w}_i$, $b_i$, $i=1,2$). For instance, a desired function $q(\mathbf{w}_1,\mathbf{w}_2,b_1,b_2)$ would be zero when $H_1$ and $H_2$ coincide.
One such quantity could be the Euclidean norm of the difference between $\mathbf{w}_1$ and $\mathbf{w}_2$, i.e., $q=\lVert\mathbf{w}_1-\mathbf{w}_2\rVert$, but obviously this is not a good choice, since every pair of parallel hyperplanes would lead to $q=0$ (which would mean "absolutely similar").
I am absolutely unaware of such issues; is there any way of quantifying such similarity? 
 A: A possible simple measure could be
$$ q' = \left\lVert \mathbf{w}_1' - \mathbf{w}_2' \right\rVert, $$
where
$$ \mathbf{w}_i' = \frac{1}{\left\lVert \left[ \mathbf{w}_i^T, b_i \right]^T \right\rVert}\left[ \mathbf{w}_i^T, b_i \right]^T. $$
This is non-zero when the planes are parallel or the angle between the plane normals is non-zero.
However, note that this approach may fail when the angle between $ \mathbf{w}_1 $ and $ \mathbf{w}_2 $ is larger than $180^\circ$, in which case the planes might actually coincide or be very close, but the vectors $ \mathbf{w}'_1 $ and $ \mathbf{w}'_2 $ will have opposite signs. It is thus necessary to take this possibility into account and define the measure as
$$ q = \min\left( \left\lVert \mathbf{w}_1' - \mathbf{w}_2' \right\rVert, \left\lVert \mathbf{w}_1' + \mathbf{w}_2' \right\rVert \right). $$

Another possible measure is picking a set of points, lying on one of the planes, and calculating the average of their euclidean distances to the other plane. This might be useful especially in the case of fitting a plane to a set of points, when you know the ground truth plane, from which the set was generated (e.g. when comparing different plane fitting approaches).
