July 2017
Beginner to intermediate
420 pages
10h 56m
English
Now, the magic happens. The first thing we're going to do is create a HashingTF object, and we're going to pass in a parameter of 100,000. This means that I'm going to hash every word into one of 100,000 numerical values:
hashingTF = HashingTF(100000)
Instead of representing words internally as strings, which is very inefficient, it's going to try to, as evenly as possible, distribute each word to a unique hash value. I'm giving it up to 100,000 hash values to choose from. Basically, this is mapping words to numbers at the end of the day.
Next, I'm going to call transform on hashingTF with my actual RDD of documents:
tf = hashingTF.transform(documents)
That's going to take my list of words ...
Read now
Unlock full access