Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.4/commons-lang3-3.4.jar"/>
<classpathentry kind="lib" path="lib/commons-math3-3.6.1/commons-math3-3.6.1.jar"/>
<classpathentry kind="lib" path="/home/lee/workspace/RPHash/lib/knn-0.1-jar-with-dependencies.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/java"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="lib/commons-lang3-3.4/commons-lang3-3.4.jar"/>
<classpathentry kind="lib" path="lib/commons-math3-3.6.1/commons-math3-3.6.1.jar"/>
<classpathentry kind="lib" path="C:/Users/deysn/Downloads/jar_files/knn-0.1-jar-with-dependencies.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
126 changes: 83 additions & 43 deletions src/main/java/edu/uc/rphash/RPHash.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,25 @@
import edu.uc.rphash.decoders.DepthProbingLSH;
import edu.uc.rphash.decoders.Dn;
import edu.uc.rphash.decoders.E8;
import edu.uc.rphash.decoders.Golay;

import edu.uc.rphash.decoders.Leech;
import edu.uc.rphash.decoders.MultiDecoder;
import edu.uc.rphash.decoders.OriginDecoder;
import edu.uc.rphash.decoders.PsdLSH;

import edu.uc.rphash.decoders.Spherical;
import edu.uc.rphash.projections.DBFriendlyProjection;
import edu.uc.rphash.projections.FJLTProjection;
import edu.uc.rphash.projections.GaussianProjection;
import edu.uc.rphash.projections.NoProjection;
import edu.uc.rphash.projections.SVDProjection;
import edu.uc.rphash.tests.StatTests;
import edu.uc.rphash.tests.clusterers.AdaptiveMeanShift;

import edu.uc.rphash.tests.clusterers.Agglomerative3;
import edu.uc.rphash.tests.clusterers.DummyClusterer;
import edu.uc.rphash.tests.clusterers.DBScan;
import edu.uc.rphash.tests.clusterers.KMeans2;
import edu.uc.rphash.tests.clusterers.KMeansPlusPlus;
import edu.uc.rphash.tests.clusterers.LloydIterativeKmeans;

import edu.uc.rphash.tests.clusterers.MultiKMPP;
import edu.uc.rphash.tests.clusterers.StreamingKmeans;
import edu.uc.rphash.tests.clusterers.StreamingKmeans2;
Expand All @@ -51,17 +51,26 @@
public class RPHash {

static String[] clusteringmethods = { "simple", "streaming", "multiproj",
"kmeans", "pkmeans","kmeansplusplus", "streamingkmeans", "adaptive","dummy" };
"kmeans", "pkmeans","kmeansplusplus", "streamingkmeans", "adaptive","dummy" ,"twrp" , "twrpbisect", "twrpbest", "twrpmergetree", "twrpbest_afterpruning",
"twrpbest_cov","twrpbest_meanvariance" };

static String[] offlineclusteringmethods = { "singlelink", "completelink",
"averagelink", "kmeans", "adaptivemeanshift", "kmpp", "multikmpp" , "dbscan", "none" };

static String[] projectionmethods = { "dbf", "fjlt", "rp", "svd", "noproj" };

static String[] ops = { "numprojections", "innerdecodermultiplier",
"numblur", "randomseed", "hashmod", "parallel", "streamduration",
"raw", "decayrate", "dimparameter", "decodertype",
"offlineclusterer", "runs", "normalize", "projection" };

static String[] decoders = { "dn", "e8", "golay", "multie8", "leech",
"multileech", "sphere", "levypstable", "cauchypstable",
"gaussianpstable", "adaptive", "origin" };

static String[] twrp_options = { "cutoff", "randomvector" };



public static void main(String[] args) throws NumberFormatException,
IOException, InterruptedException {
Expand Down Expand Up @@ -95,6 +104,12 @@ public static void main(String[] args) throws NumberFormatException,
System.out.print(s + " ,");
System.out.print("]\n");

System.out.print("\t twrp_options" + "\t:[");
for (String s : twrp_options)
System.out.print(s + " ,");
System.out.print("]\n");


System.exit(0);
}

Expand All @@ -114,6 +129,9 @@ public static void main(String[] args) throws NumberFormatException,
matched |= keyword.equals(match);
for (String match : decoders)
matched |= keyword.equals(match);
for (String match : twrp_options)
matched |= keyword.equals(match);

if (!matched)
unmatchedkeywords.add(keyword);
}
Expand Down Expand Up @@ -503,6 +521,20 @@ public static List<Clusterer> runConfigs(List<String> untaggedArgs,
o.setNormalize(Boolean.parseBoolean(taggedArgs.get("normalize")));
so.setNormalize(Boolean.parseBoolean(taggedArgs.get("normalize")));
}


if (taggedArgs.containsKey("cutoff")) {
o.setCutoff(Integer.parseInt(taggedArgs.get("cutoff")));
so.setCutoff(Integer.parseInt(taggedArgs.get("cutoff")));
}


if (taggedArgs.containsKey("randomvector")) {
o.setRandomVector(Boolean.parseBoolean(taggedArgs.get("randomvector")));
so.setRandomVector(Boolean.parseBoolean(taggedArgs.get("randomvector")));
}



if (taggedArgs.containsKey("projection")) {
switch (taggedArgs.get("projection")) {
Expand Down Expand Up @@ -552,11 +584,7 @@ public static List<Clusterer> runConfigs(List<String> untaggedArgs,
so.setDecoderType(new E8(2f));
break;
}
case "golay": {
o.setDecoderType(new Golay());
so.setDecoderType(new Golay());
break;
}

case "multie8": {
o.setDecoderType(new MultiDecoder(
o.getInnerDecoderMultiplier() * 8, new E8(2f)));
Expand All @@ -576,23 +604,9 @@ public static List<Clusterer> runConfigs(List<String> untaggedArgs,
.getInnerDecoderMultiplier() * 24, new Leech()));
break;
}
case "levypstable": {
o.setDecoderType(new PsdLSH(PsdLSH.LEVY, o.getDimparameter()));
so.setDecoderType(new PsdLSH(PsdLSH.LEVY, o.getDimparameter()));
break;
}
case "cauchypstable": {
o.setDecoderType(new PsdLSH(PsdLSH.CAUCHY, o.getDimparameter()));
so.setDecoderType(new PsdLSH(PsdLSH.CAUCHY, o.getDimparameter()));
break;
}
case "gaussianpstable": {
o.setDecoderType(new PsdLSH(PsdLSH.GAUSSIAN, o
.getDimparameter()));
so.setDecoderType(new PsdLSH(PsdLSH.GAUSSIAN, o
.getDimparameter()));
break;
}



case "sphere": {// pad to ~32 bits
// int ctsofsphere =
// (int)(Math.log(o.getDimparameter()*2)/Math.log(2.0)) /2;
Expand Down Expand Up @@ -659,13 +673,7 @@ public static List<Clusterer> runConfigs(List<String> untaggedArgs,
o.setOfflineClusterer(new KMeansPlusPlus());
so.setOfflineClusterer(new KMeansPlusPlus());
break;
case "adaptivemeanshift": {

o.setOfflineClusterer(new AdaptiveMeanShift());
so.setOfflineClusterer(new AdaptiveMeanShift());

break;
}

case "kmpp": {

o.setOfflineClusterer(new KMeansPlusPlus());
Expand Down Expand Up @@ -727,11 +735,7 @@ public static List<Clusterer> runConfigs(List<String> untaggedArgs,
runitems.add(new KMeans2(k, o.getRawData()));
break;
}
case "pkmeans":
runitems.add(new LloydIterativeKmeans(k, o.getRawData(), o
.getNumProjections()));
break;


case "kmeansplusplus":
runitems.add(new KMeansPlusPlus(o.getRawData(), k));
break;
Expand All @@ -743,14 +747,50 @@ public static List<Clusterer> runConfigs(List<String> untaggedArgs,
runitems.add(new StreamingKmeans2(o));
break;
}
case "adaptivemeanshift": {
runitems.add(new AdaptiveMeanShift());
break;
}

case "adaptive": {
runitems.add(new RPHashAdaptive2Pass(o));
break;
}

case "twrp": {
runitems.add(new TWRPv2(o));
break;
}

case "twrpmergetree": {
runitems.add(new TWRPv3(o));
break;
}

case "twrpbisect": {
runitems.add(new TWRPv4(o));
break;
}

case "twrpbest": {
runitems.add(new TWRPv5_WCSS(o));
break;
}

case "twrpbest_afterpruning": {
runitems.add(new TWRPv6_WCSS2(o));
break;
}

case "twrpbest_cov": {
runitems.add(new TWRPv6_COV(o));
break;
}

case "twrpbest_meanvariance": {
runitems.add(new TWRPv6_meanVariance(o));
break;
}




case "dummy": {
runitems.add(new DummyClusterer(so));
break;
Expand Down
Loading