April 2017
Intermediate to advanced
532 pages
12h 39m
English
The inverse document frequency(IDF)represents how much information the word provides: is the term common or rare across the corpus. It is the log scaled inverse fraction of the documents containing the word, calculated by division of the total number of documents by the number of documents containing the termTF-IDF
TF-IDF is calculated by multiplying TF and IDF.
The following example calculates TFIDF for each term in the Apache Spark README.md file:
object TfIdfSample{ def main(args: Array[String]) { // TODO replace with path specific to your machine val file = Util.SPARK_HOME + "/README.md" val spConfig = (new SparkConf).setMaster("local").setAppName("SparkApp") ...Read now
Unlock full access