Distance of a point from a plane
While solving classification problems in machine learning we try to find a model(mathematical shape) to classify points. Let’s take plane as an example. The distance of a point from a plane is directly proportional to the confidence it has been correctly classified. In this post, we will learn how to find the distance of a point from a plane.
Pre-requisite for this post is knowledge of
1- Equation of a plane and what each symbol means in that.
2- What is a dot product.
Let’s start with equation of a plane
Finding d is the goal of this post
It is the perpendicular distance of point from the plane.
NOTE: For simplicity we have removed the axis.
Before finding d we will find the distance of plane from the origin.
NOTE: Don’t get confused if I write wTx or w.x, they are both dot product between w and x.
Case 1: Finding d when point is above the plane
We already know n; it is the distance of plane from origin. So let’s find m.
Now we know m and n. Let’s find d
Case 2: Finding d when point is below the plane
Again we know n. Let’s find m in this case
Now we know both m and n. Let’s find d
In both the cases we got similar end results. If we look closely at the end equation it is as same as putting point p in the equation of plane and then dividing by |w|.
Now you know how to find the distance of point from a plane.
In case of any doubt or queries or any suggestions please leave a comment below. Would love to help.