April 2017
Intermediate to advanced
532 pages
12h 39m
English
Let's start with a very simple dataset of random numbers:
val transactions = Seq( "r z h k p", "z y x w v u t s", "s x o n r", "x z y m t s q e", "z", "x z y r q t p") .map(_.split(" "))
We will find out the most frequent items (character in this case). First, we will get the spark context as follows:
val sc = new SparkContext("local[2]", "Chapter 5 App")
Convert our data in an RDD:
val rdd = sc.parallelize(transactions, 2).cache()
Initialize the FPGrowth instance:
val fpg = new FPGrowth()
Read now
Unlock full access