Last week, you looked at tokenizing text.
Where turn text into sequences of numbers with
a number was the value of
a key value pair with the key being the word.
So for example, you could represent
the word TensorFlow with the value nine,
and then replace every instance of
the word with a nine in a sequence.
Using tools and TensorFlow,
you are able to process strings to
get indices of all the words in
a corpus of strings and then convert
the strings into matrices of numbers.
This is the start of getting
sentiment out of your sentences.
But right now, it's still just a string
of numbers representing words.
So from there, how would one actually get sentiment?
Well, that's something that can be
learned from a corpus of words
in much the same way as
features were extracted from images.
This process is called embedding,
with the idea being that words and
associated words are clustered
as vectors in a multi-dimensional space.
Here, I'm showing an embedding projector
with classifications of movie reviews.
This week, you'll learn how to build that.
The reviews are in two main categories;
positive and negative.
So together with the labels,
TensorFlow was able to build these embeddings showing
a clear clustering of words that are
distinct to both of these review types.
I can actually search for words
to see which ones match a classification.
So for example, if I search for boring,
we can see that it lights up in
one of the clusters and that
associated words were clearly
negative such as unwatchable.
Similarly, if I search for a negative word like annoying,
I'll find it along with annoyingly in
the cluster that's clearly the negative reviews.
Or if I search for fun,
I'll find that fun and funny are positive,
fundamental is neutral,
and unfunny is of course, negative.
This week, you'll learn how to use embeddings and how
to build a classifier that gave that visualization.
You're most of the way there already with the work that
you've been doing with string tokenization.
We'll get back to that later but first let's look at
building the IMDB classification
that you just visualized.