The Cosine Law and Similarity Measures#

Machine learning algorithms often rely on understanding how similar or dissimilar different data points are. Whether it’s recommending movies, clustering customer profiles, or detecting similar-looking images, the concept of similarity lies at the heart of many ML tasks. In this blog post, we’ll explore three fundamental similarity measures and examine when they’re most appropriate to use:

  • Dot Product

  • Cosine Similarity

  • Euclidean Distance

image.png

When we say two objects are similar, we imply that they share certain characteristics or features. Mathematically, we can represent objects as vectors in a multi-dimensional space. Each dimension represents a feature. Similarity measures are tools that take these vector representations and calculate a numerical score quantifying how close or alike those vectors are.

What is multi-dimensional space?#

Science says that we live in a multi-dimensional space but due to limitations of our senses we cannot understand or imagine them

Space#

A space is defined as - the boundless three-dimensional extent in which objects and events have relative position and direction. In simple words its just a void ( empty space ) wherein we can move in any direction.

Dimension#

A Dimension is defined as - a measurable extent of a particular kind. In simple workds Dimension is something that changes and can be measured - we cannot measure something that does not change. Our brain relies on similarities and differences, hence our brain does not understand something which does not change.


Now when we club these understanding we get something called as Space with Dimension - A change in the position of an object in a void. We call Dimension only because we can measure it. The coordinate system was created for humans to understand and correlate e.g. 3-dimensional x,y,z co-ordinates. So can we see a complete Apple in 3D Space? Nope, we can only see the visible parts of an apple in 2D. Our brain can generate a 3D model of an apple by clubbing all the 2D images which we see by rotating the Apple in our hand and that’s how we can perceive the 3D model of an apple.

the main issue is, it is impossible… you can not “draw” anything above 2 dimensions… even 3d vectors cannot technically be drawn, only their projections in 2d space can be represented.

This becomes even more clear when youre attempting to visualize 4d and above.

TODO: Principal Component Analysis (PCA)#

Principal Component Analysis (PCA) to project it to a lower dimensional space with minimal loss of variance. this would maintain as much information as possible need to explore this topic...