From the course: Machine Learning with Data Reduction in Excel, R, and Power BI

Unlock the full course today

Join today to access over 23,100 courses taught by industry experts.

Calculating distances

Calculating distances

- [Instructor] Distance is our key component of machine learning models like dimensionality which also starts with D. Calculating the euclidean distances in our model lets us determine which data points are close together and which ones are far apart. Let's look at a Cartesian coordinate plane. We can easily determine distances between A and B as four, and A and C as three because the pairs of points are directly vertically or horizontally from each other. But what if we calculate the distance between points B and C. Because they're not along the same extra Y axis we need to use the Pythagorean theorem to determine the distance between the two points as the length of a triangle called the hypotenuse. The Pythagorean theorem states that the length of the hypotenuse C equals the square root of the sum of A squared, plus the sum of B squared. The distance between points B and C in our triangle, therefore equals the square…

Contents