O'Reilly logo

Machine Learning with Spark - Second Edition by Nick Pentreath, Manpreet Singh Ghotra, Rajdeep Dua

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Excluding terms based on frequency

It is also a common practice to exclude terms during tokenization when their overall occurrence in the corpus is very low. For example, let's examine the least occurring terms in the corpus (notice the different ordering we use here to return the results sorted in ascending order):

val oreringAsc = Ordering.by[(String, Int), Int](-_._2) println(tokenCountsFilteredSize.top(20)(oreringAsc)  .mkString("n"))

You will get the following results:

(lennips,1)(bluffing,1)(preload,1)(altina,1)(dan_jacobson,1)(vno,1)(actu,1)(donnalyn,1)(ydag,1)(mirosoft,1)(xiconfiywindow,1)(harger,1)(feh,1)(bankruptcies,1)(uncompression,1)(d_nibby,1)(bunuel,1)(odf,1)(swith,1)(lantastic,1)

As we can see, there are many terms that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required