Sitemap
shila

shila

Embedding

2 min readApr 1, 2026

--

Embedding simply means representing text, audio and images in points in continious vector space, that is semantically meaningful to machine learning algorithm. In essance, embedding enables machine learning model to find similar objects.

Various algorithms are used in learning from the data such as neural network. Embeddings are used for:-

  • Search (Where results are ranked by relevance to a query string)
  • Clustering (Where text strings are grouped by similarity)
  • Recommendation (Where items with related text strings are recommended)
  • Anomaly detection (Where outliers with little relatedness are identified)
  • Diversity measurement (where similarity distribution are analyzed)
  • Classification (Where text strings are classified by their most similar label)

How embedding works

Machine learning algorithms can only take two dimensional numerical data as input so that it is easy to find similarity between the words. It is necessary to convert text in numerical format.

Here is how two words, “dad” and “mom” would be represented as vectors:

Get shila’s stories in your inbox

Join Medium for free to get updates from this writer.

“dad”=[0.1548,0.4848,…,1.864]

“mom”=[0.8785,0.8974,…,2.794]

RecommendationScore = UserEmbedding.ItemEmbedding

The embedding matrices are learned through a training process using historical user-item interactions. Once the model is trained, it can be used to generate top-N recommendation for users. The items with the highest predicted scores for a user are recommended.

Press enter or click to view image in full size

Why use embedding

  1. Semantic representation: By mapping (words, images, nodes in garph etc.) to vector in a continous space, embeddings capture semantic relationships and similarities, enabiling models to understand new data they’ve never seen before, just like humans do naturally.
  2. Dimensionality reduction: Changing high dimensional text, images, audio or graphs into lower-dimensional representations making it computationally erfficient and easier to work with.
  3. Improved generalization of models: Models can generalize well to unseen examples, making embeddings crucial for task with limited labeled data.
  4. Effective Visualization: t-SNE is like a magic flattening machine it takes your 300-dimensional word vectors and squishes them onto a 2D screen, while keeping similar words close together so you can literally SEE the meaning in your data!

Vector Techniques includes:

  1. Classical Embedding (Traditional/Statistical): Classical embedding are older techniques that represent text using frequency or co-occurrence statistics, not deep understanding of meaning. eg. Bag of Words (Bow), TF-IDF (Term Frequency-Inverse Document Frequency), Count Vectors. Works well for basic tasks and simple.
  2. Semantic Embedding : Semantic embeddings are created using deep learning models that understand meaning, context and relationship. It uses pre-trained word embeddings, such as Glove, Word2Vec, FastText etc and replaces the original word in the sentence with its closet neighbor in embedding space. In algebraic settings, they involve encoding information intro structured mathematical system wehre meaning emerges from logical relationships and rules between elements and solution are derived by constructing models that satisfy those relationship.

--

--