From the course: Deep Learning Foundations: Natural Language Processing with TensorFlow

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Introduction to word embeddings

Introduction to word embeddings

- [Instructor] Machine Learning models take vectors or you can say arrays of numbers as input. When you're working with text, the first thing that you must do is come up with a strategy to convert strings to numbers. Or to vectorize your text before you feed it to the model. There are two common vectorizing strategies: One-hot encoding and Unique number encoding. So as a first idea, you might one-hot encode each word in your vocabulary. So consider the sentence, "The weather seems to be cloudy." Now, the vocabulary or unique words in the sentence are weather, be, to, seem, cloudy, and the. To represent each word, you will create a zero vector with length equal to the vocabulary, and then place a one in the index that corresponds to the word, as you can see in this diagram. So wherever you see the in the sentence corresponding to that index you place one. Similarly for weather, similarly for seems, and so on. The…

Contents