Natural Language Processing (Part 30)-Manipulating Words in Vector Spaces
📚Chapter 3: Vector Space Model
Introduction
In this tutorial, you’re going to learn to manipulate vectors by performing some simple vector arithmetic. Meaning by adding vectors or subtracting vectors, you’ll be able to predict the countries of certain capitals.
Sections
Manipulating word Vectors
Summary
Section 1- Manipulating word Vectors.
Let’s dive in. I’ll show you how to manipulate vector representations in order to infer unknown relations among words. Suppose that you have a vector space with countries and their capital cities. You know that the capital of the United States is Washington DC, and you don’t know the capital of Russia. But you’d like to use the known relationship between Washington DC and the USA to figure it out.
For that, you’ll just use some vector algebra. For this example, you are in a hypothetical two-dimensional vector space that has different representations for different countries and capitals cities. First, you will have to find the relationship between the Washington DC, and USA vector representations. In other words, which vector connects them?
To do that, get the difference between the two vectors. The values from that will tell you how many units on each dimension you should move in order to find a country’s capital in that vector space.
To find the capital city of Russia, you will have to sum its vector representation with the vector that you also got in the last step. At the end, you should deduce that the capital of Russia has a vector representation of 10, 4.
However, there are no cities with that representation, so you’ll have to take the one that is the most similar to it’s by comparing each vector with a Euclidean distances or cosine similarities.
In this case, the vector representation that is closest to the 10, 4 is the one for Moscow. Using the simple process, you could have predicted the capital of Russia if you knew the capital of the USA. The only catch here is that you need a vector space where the representations capture the relative meaning of words.
Summary
Now you have a simple process to get unknown relationships between words, by the use of known relationships between others. You now know the importance of having vector spaces where the representations of words capture their relative meaning in natural language. In upcoming parts of this specialization, you’ll perform more sophisticated tasks taking advantage of this representation. You have now seen the clustering of all vectors when plotted on two axes. You have also seen that the vectors of the words that occur in similar places in the sentence, will be encoded in a similar way. You can take advantage of this type of consistency encoding to identify patterns. For example, if you have the word doctor and you are to find the closest words that are closest to it by computing cosine similarity, you might get the word doctors, nurse, cardiologist, surgeon, etc. In the next Tutorial, you will learn how to to plot these d-dimensional vectors on a 2D plane.
Please Follow and 👏 Clap for the story courses teach to see latest updates on this story
If you want to learn more about these topics: Python, Machine Learning Data Science, Statistic For Machine learning, Linear Algebra for Machine learning Computer Vision and Research
Then Login and Enroll in Coursesteach to get fantastic content in the data field.
Stay tuned for our upcoming articles where we will explore specific topics related to NLP in more detail!
Remember, learning is a continuous process. So keep learning and keep creating and sharing with others!💻✌️
Note:if you are a NLP export and have some good suggestions to improve this blog to share, you write comments and contribute.
if you need more update about NLP and want to contribute then following and enroll in following
👉Course: Natural Language Processing (NLP)
Do you want to get into data science and AI and need help figuring out how? I can offer you research supervision and long-term career mentoring.
Skype: themushtaq48, email:mushtaqmsit@gmail.com
Contribution: We would love your help in making coursesteach community even better! If you want to contribute in some courses , or if you have any suggestions for improvement in any coursesteach content, feel free to contact and follow.
Together, let’s make this the best AI learning Community! 🚀
Source
1- Natural Language Processing with Classification and Vector Spaces