Concept
We represent n dimension data and equation in machine learning using algebra as,
wT・x + w0 = 0
Where w = [w1 w2 ... wn] is normal of the plane or weights.
and x = [x1 x2 ... xn] is representation of features or dimension.
and we represent its distance from origin or perpendicular from origin to plane as -w0/|w|,
where, |w| =
Let's see if this is true and imagine the case in 3D, (Beautifully generated by GeoGebra)
Plane in 3 Dimensions |
Here we have taken the plane passing through three points A, B, and C but not from the origin. We have calculated the shortest or perpendicular distance from the origin.
We can represent 3D plane as ax + by + cz + d = 0 or,
w1x1 + w2x2 + w3x3 + w0 = 0.
a = w1 = -10.47
b = w2 = -4.85
c = w3 = -3
d = w0 = 25.42
distance = 2.13
Let's calculate the distance using the formula,
>import math
>print((25.42)/math.sqrt((10.47)**2+(4.85)**2+(3)**2))
>2.1321227126291182
Comments
Post a Comment