Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/4714#discussion_r25124128
--- Diff:
examples/src/main/java/org/apache/spark/examples/mllib/JavaFPGrowthExample.java
---
@@ -25,32 +25,49 @@
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
+import org.apache.spark.api.java.function.Function;
import org.apache.spark.mllib.fpm.FPGrowth;
import org.apache.spark.mllib.fpm.FPGrowthModel;
/**
* Java example for mining frequent itemsets using FP-growth.
+ * Example usage: ./bin/run-example
org.apache.spark.examples.mllib.JavaFPGrowthExample
+ * ./data/mllib/sample_fpgrowth.txt
*/
public class JavaFPGrowthExample {
public static void main(String[] args) {
+ String inputFile;
+ double minSupport = 0.3;
+ int numPartition = -1;
+ if (args.length < 1) {
+ System.err.println(
+ "Usage: JavaKMeans <input_file> [minSupport]
[numPartition]");
+ System.exit(1);
+ }
+ inputFile = args[0];
+ if (args.length >= 2) {
+ minSupport = Double.parseDouble(args[1]);
+ }
+ if (args.length >= 3) {
+ numPartition = Integer.parseInt(args[2]);
+ }
+
SparkConf sparkConf = new
SparkConf().setAppName("JavaFPGrowthExample");
JavaSparkContext sc = new JavaSparkContext(sparkConf);
+ JavaRDD<ArrayList<String>> transactions = sc.textFile(inputFile).map(
+ new Function<String, ArrayList<String>>() {
+ @Override
--- End diff --
fix indentation
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]