Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Hwanjun Song authored Mar 7, 2018
1 parent 4c570ba commit 1c31434
Show file tree
Hide file tree
Showing 27 changed files with 21 additions and 5 deletions.
Binary file modified RP_DBSCAN/bin/dm/kaist/algorithm/Conf.class
Binary file not shown.
Binary file modified RP_DBSCAN/bin/dm/kaist/algorithm/Methods$AggregateCount.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified RP_DBSCAN/bin/dm/kaist/algorithm/Methods$BuildMST.class
Binary file not shown.
Binary file modified RP_DBSCAN/bin/dm/kaist/algorithm/Methods$CountCorePts.class
Binary file not shown.
Binary file modified RP_DBSCAN/bin/dm/kaist/algorithm/Methods$CountEdge.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified RP_DBSCAN/bin/dm/kaist/algorithm/Methods$FinalPhase.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified RP_DBSCAN/bin/dm/kaist/algorithm/Methods$Repartition.class
Binary file not shown.
Binary file not shown.
Binary file modified RP_DBSCAN/bin/dm/kaist/algorithm/Methods.class
Binary file not shown.
Binary file modified RP_DBSCAN/bin/dm/kaist/algorithm/RP_DBSCAN.class
Binary file not shown.
Binary file modified RP_DBSCAN/bin/dm/kaist/io/FileIO.class
Binary file not shown.
Binary file modified RP_DBSCAN/bin/dm/kaist/main/MainDriver.class
Binary file not shown.
4 changes: 4 additions & 0 deletions RP_DBSCAN/src/dm/kaist/algorithm/Conf.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public static void setInputParameters(String[] args)
System.out.println(" -bs : the block size for virtually combining two-level cell dictionary (default : 1).");
System.out.println(" -l : the hdfs path to write labeled points, <point id, cluster label> (default : no output).");
System.exit(1);
}else if(rho < 0.009999)
{
System.out.println("This version deos not support rho < 0.01!. We recommend you to set rho = 0.02 or 0.01 for accuracy.");
System.exit(1);
}
}

Expand Down
15 changes: 11 additions & 4 deletions RP_DBSCAN/src/dm/kaist/algorithm/Methods.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,15 @@ public static class PseudoRandomPartition implements PairFunction<Tuple2<List<In
private int dim = 0;
private float levelpSideLen = 0;
private int metaBlockWindow = 0;
private String pairOutputPath = null;

public PseudoRandomPartition(int dim, float epsilon, float p, int metaBlockWindow) {
public PseudoRandomPartition(int dim, float epsilon, float p, int metaBlockWindow, String pairOutputPath) {
// TODO Auto-generated constructor stub
this.dim = dim;
int LOWEST_LEVEL = (int)(Math.ceil(1 - Math.log10(p)/Math.log10(2)));
this.levelpSideLen = epsilon / ((float)Math.sqrt(dim) * (1 << LOWEST_LEVEL-1));
this.metaBlockWindow = metaBlockWindow;
this.pairOutputPath = pairOutputPath;
}

@Override
Expand All @@ -206,10 +208,14 @@ public Tuple2<List<Integer>, ApproximatedCell> call(Tuple2<List<Integer>, Iterab
{
ApproximatedPoint apprPt = new ApproximatedPoint(pt.id, pt.coords);
map.put(lvH, apprPt);
apprPt.ptsIds = new ArrayList<Long>();

if(pairOutputPath != null)
apprPt.ptsIds = new ArrayList<Long>();
}
map.get(lvH).count++;
map.get(lvH).ptsIds.add(pt.id);

if(pairOutputPath != null)
map.get(lvH).ptsIds.add(pt.id);
}

ApproximatedCell cell = new ApproximatedCell(pts._1);
Expand Down Expand Up @@ -745,7 +751,8 @@ public void findDDRWithSpecificMeta(int readOrder, HashSet<Edge> edges, List<App
closest = neighbor.lv_p_kdtree.cloestNode(node.coords,sqr_r);

if(node == null || closest == null || Norm.sqr_L2_norm(node.coords, closest.coords) <= sqr_r)
edges.add(edge);
edges.add(edge);

}
}
meta = null;
Expand Down
2 changes: 1 addition & 1 deletion RP_DBSCAN/src/dm/kaist/algorithm/RP_DBSCAN.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void phaseI()
.combineByKey(new Methods.CreateLocalApproximatedPoint(Conf.dim, Conf.epsilon, Conf.rho), new Methods.LocalApproximation(Conf.dim, Conf.epsilon, Conf.rho), new Methods.GlobalApproximation(Conf.dim))
.mapToPair(new Methods.PseudoRandomPartition2(Conf.metaBlockWindow)).persist(StorageLevel.MEMORY_AND_DISK_SER());
}else
dataMap = lines.mapToPair(new Methods.PointToCell(Conf.dim, Conf.epsilon)).groupByKey().mapToPair(new Methods.PseudoRandomPartition(Conf.dim, Conf.epsilon, Conf.rho, Conf.metaBlockWindow)).persist(StorageLevel.MEMORY_AND_DISK_SER());
dataMap = lines.mapToPair(new Methods.PointToCell(Conf.dim, Conf.epsilon)).groupByKey().mapToPair(new Methods.PseudoRandomPartition(Conf.dim, Conf.epsilon, Conf.rho, Conf.metaBlockWindow, Conf.pairOutputPath)).persist(StorageLevel.MEMORY_AND_DISK_SER());

numOfCells = dataMap.count();

Expand Down
5 changes: 5 additions & 0 deletions RP_DBSCAN/src/dm/kaist/io/FileIO.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,14 +66,19 @@ public static List<String> broadCastData(JavaSparkContext sc, Configuration conf
FileStatus[] status = fs.listStatus(new Path(dirPath));
List<String> metaPaths = new ArrayList<String>();

long size = 0;

for(int i=0; i<status.length; i++)
{
String path = status[i].getPath().toString();
String fileName = status[i].getPath().getName();
sc.addFile(path);
metaPaths.add(fileName);

size += status[i].getLen();
}

System.out.println("size : " + size);
return metaPaths;
}
}

0 comments on commit 1c31434

Please sign in to comment.