Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering Machine Learning with Spark 2.x

You're reading from   Mastering Machine Learning with Spark 2.x Harness the potential of machine learning, through spark

Arrow left icon
Product type Paperback
Published in Aug 2017
Publisher Packt
ISBN-13 9781785283451
Length 340 pages
Edition 1st Edition
Languages
Arrow right icon
Authors (3):
Arrow left icon
Alex Tellez Alex Tellez
Author Profile Icon Alex Tellez
Alex Tellez
Michal Malohlava Michal Malohlava
Author Profile Icon Michal Malohlava
Michal Malohlava
Max Pumperla Max Pumperla
Author Profile Icon Max Pumperla
Max Pumperla
Arrow right icon
View More author details
Toc

Motivation of word vectors

Similar to the work we did in the previous chapter, traditional NLP approaches rely on converting individual words--which we created via tokenization--into a format that a computer algorithm can learn (that is, predicting the movie sentiment). Doing this required us to convert a single review of N tokens into a fixed representation by creating a TF-IDF matrix. In doing so, we did two important things behind the scenes:

  1. Individual words were assigned an integer ID (for example, a hash). For example, the word friend might be assigned to 39,584, while the word bestie might be assigned to 99,928,472. Cognitively, we know that friend is very similar to bestie; however, any notion of similarity is lost by converting these tokens into integer IDs.
  2. By converting each token into an integer ID, we consequently lose the context with which the token was used. This...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime