Chapter 7: Market Basket Analysis¶
Programs of chapter 7 of the book Data Algorithms (O'Reilly, 2015), running on Spark 4.3.0.
Sample input: data/chap07/transactions.txt
Run the commands from the repository folder after building the jar (Running the programs).
Spark (Java)¶
chap07.spark.FindAssociationRules¶
Source: FindAssociationRules.java
scripts/run_spark.sh org.dataalgorithms.chap07.spark.FindAssociationRules data/chap07/transactions.txt
- Writes to
rules/in the current directory; delete it first if it exists:rm -r rules
chap07.spark.FindAssociationRulesWithLambda¶
Source: FindAssociationRulesWithLambda.java
scripts/run_spark.sh org.dataalgorithms.chap07.spark.FindAssociationRulesWithLambda data/chap07/transactions.txt
- Writes to
rules/in the current directory; delete it first if it exists:rm -r rules
Spark (Scala)¶
chap07.scala.FindAssociationRules¶
Source: FindAssociationRules.scala
scripts/run_spark.sh org.dataalgorithms.chap07.scala.FindAssociationRules data/chap07/transactions.txt /tmp/data-algorithms/chap07.scala.FindAssociationRules/output
MapReduce (Hadoop)¶
chap07.mapreduce.MBADriver¶
Source: MBADriver.java
scripts/run_mapreduce.sh org.dataalgorithms.chap07.mapreduce.MBADriver data/chap07/transactions.txt /tmp/data-algorithms/chap07.mapreduce.MBADriver/output 2