Skip to main content

Command Palette

Search for a command to run...

What's word embedding?

Published
2 min read
What's word embedding?
J

Senior AI Engineer | Building & Telling Stories about AI/ML Systems | Software Engineer

🧩 What's word embedding?

Do you wonder how #ArtificialIntelligence algorithms process text?

Word embeddings take words and turn them into vectors.

It helps computers understand words like humans do!

🌌 Embeddings

Embedding has the property:

- similar words are closer

- different words are farther apart.

So, "king" and "man" are close, just like "queen" and "woman".

This space is called the "embedding/latent space".

A universe of words in number form.

🧠 Algorithms

Algorithms like Word2Vec, GloVe, and FastText are training with a LOTS of text.

They learn the number patterns for each word.

These patterns show word relationships like friendships, opposites, and more!

🛠️ Why?

Word embeddings help:

- in understanding if a movie review is happy or sad

- finding information quickly, etc.

📖 How does embedding work?

Input: a sequence of integers. Used as the index to access a table that contains all possible vectors.

Let's suppose that you have the following sentence: "Nice to see you again".

First, we need to encode the sentence into a list of integer.

Assign each word a unique integer number.

For example, by order of appearance in our dataset.

Then, let's train a network whose first layer is an embedding layer for a particular task.

Once trained, the embedding layer is a matrix of shape (7, 2) as shown below.

This is a map of integers to embedding vectors.

So, the list of integers above is represented using the embedding as:

🎓 Conclusion

Word embeddings are like a secret language of numbers for words.

They help computers understand and play around with language just like a human.

Trained by reading and learning from tons of texts.

And guess what?

They're everywhere in tech today!

Let's just mention #ChatGPT #Claude #GPT4

#MachineLearning #deeplearning #NeuralNetworks

PS: If you like this, share this post ♻️

More from this blog

Juan C Olamendy

122 posts

🤖 Talk about AI/ML · AI-preneur 🛠️ Build AI tools 🚀 Share my journey 𓀙 🔗 pixela.io · 🛍️ shoppingbot.ai