Cosine Similarity for Data Science Tutorial

Поділитися
Вставка
  • Опубліковано 28 чер 2024
  • Cosine similarity is a measure of how two multi-dimensional data points are alike. We'll explore the metric along with a Python example in this tutorial.
    Table of Content
    - Introduction: 0:00
    - Context: 0:24
    - Example of Cosine Similarity Usage - Graph: 1:27
    - Example of Cosine Similarity Usage - NLP: 2:44
    - Theory: 3:45
    - Formula: 5:15
    - Kaggle Notebook Overview: 6:34
    - Python Implementation | Sklearn: 7:08
    - Python Implementation | Linear Algebra with Numpy: 9:15
    - Python Implementation | from scratch: 10:10
    - Cosine Similarity with Real Data: 11:12
    - Cosine Similarity with Real Data - 1 vs 1: 12:10
    - Cosine Similarity with Real Data - good vs bad: 13:20
    - Cosine Similarity with Real Data - good vs good: 16:27
    - Cosine Similarity with Real Data - bad vs bad: 17:10
    - Conclusion: 18:04
    You can follow along in the notebook on Kaggle over here:
    📌 www.kaggle.com/code/yacine010...
    Cosine similarity is a fascinating technique that is useful for comparing two different vectors.
    This is often needed when the quantity between two vectors is very multidimensional and you don’t really know how to compare them.
    The gist of the methodology is to create two N-dimensional vectors, where N is the different features you want to take into consideration for the comparison, of the two vectors you want to compare.
    Then you look at the cosine of the angle between these two vectors.
    This is simple enough to conceptualize in 2D or 3D space but gets a bit confusing to think about in higher dimensions. Luckily the method is the same no matter the dimension.
    This cosines of the angle will range between:
    - cosine(theta) == 1 if the two vectors are very similar
    - cosine(theta) == 0 if the two vectors are orthogonal (unrelated to each other).
    - cosine(theta) == -1 if the two vectors are opposite of each other.
    ----
    If you have a request for a video, do drop a comment down below 👇
    ----
    Follow Me Online Here:
    📌 LinkedIn: / yacinemahdid
    ___
    Have a great week! 👋
  • Наука та технологія

КОМЕНТАРІ • 2