TGViewer
Big Data Science Big Data Science @bdscience · 3.57K subscribers
Post #326 501
📝Math for Data Scientist: 3 Distance Measures, Part 1
• Euclidean Distance
- measures the length of the line that connects two points. The most common measure, but not scalable. The calculated distances may be skewed depending on the units of the objects. Therefore, before using this measure, you need to normalize the data. As the dimension of the data increases, the usefulness of the Euclidean distance decreases. But this measure works great for low-dimensional data. For example, the kNN and HDBSCAN methods show good results with this measure. Finally, Euclidean distance is intuitive to use and easy to implement.
• Cosine Similarity - the cosine of the angle between two vectors. This method helps to eliminate the disadvantages of high-dimensional Euclidean distance. Two vectors with the same orientation have a cosine similarity of 1, and vectors that are diametrically opposed to each other have a similarity of -1. The magnitude of the vectors is irrelevant as this is a measure of orientation. Therefore, this measure is not very suitable for recommendation systems, because cosine similarity does not account for the difference in the rating scale between different users. Nevertheless, cosine similarity is useful when there is multidimensional data and the magnitude of the vectors does not matter, for example, for text analysis.
• Hamming distance - the number of values that differ in two vectors. Typically used to compare two binary strings of the same length, for example, to compare how similar they are to each other by calculating the number of characters that differ. Hamming distance is difficult to apply when two vectors have different lengths. For example, for correcting or detecting errors in data transmission over computer networks when determining the number of corrupted bits in a binary word as a way to estimate the error. You can also use Hamming distance to measure the distance between categorical variables.
More from @bdscience
  1. Nov 27, 2025💎 Imagen AI — an intelligent Adobe Lightroom assistant that automates photo editing by le…
  2. Oct 28, 2025🌐 OpenAI has released ChatGPT Atlas Atlas is a browser with an integrated AI sidebar, bui…
  3. Sep 16, 2025🤖 Nanobanana.ai is an AI aggregation platform that provides unified subscription-based ac…
  4. Jul 30, 2025🏀 Photoleap by Lightricks is a premier AI-powered image editing app that seamlessly blend…
  5. Jun 19, 2025⚙️ Rumi Labs transforms passive media into interactive entertainment A San Francisco-based…
  6. May 27, 2025📈Genspark AI: the autonomous super-agent for multi-step business workflows 🧠 Mixture-of-…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →