-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathSparkDBSCANMain.java
More file actions
42 lines (33 loc) · 1.19 KB
/
SparkDBSCANMain.java
File metadata and controls
42 lines (33 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package main;
import clustering.SparkDBSCAN;
import configuration.SparkFactory;
import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaSparkContext;
/**
* Created by wlucia on 29/09/15.
*/
public class SparkDBSCANMain {
public static void main(String[] args) {
if(args.length != 4) {
System.out.println("Bad Parameters :'(");
System.out.println("Usage: java -jar DistributedDbScan epsilon minPts inputFilePath outputFilePath");
System.exit(-1);
}
double epsilon = Double.parseDouble(args[0]);
int minPts = Integer.parseInt(args[1]);
String inputPath = args[2];
String outputPath = args[3];
System.out.println(String.format("*** PARAMS:\nEpsilon -> %f\nMinPts -> %d\nInput -> %s\nOutput -> %s",
epsilon,
minPts,
inputPath,
outputPath
));
JavaSparkContext jsc = new SparkFactory()
.setMaster("local[4]")
.sparkContext("Spark DBSCAN");
SparkDBSCAN dbScan = new SparkDBSCAN(jsc, epsilon, minPts, inputPath, outputPath);
dbScan.clustering();
jsc.close();
}
}