Skip to content

Commit

Permalink
config change
Browse files Browse the repository at this point in the history
  • Loading branch information
nikit-srivastava committed Oct 18, 2018
1 parent b9bffd8 commit 7dcfff3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class W2VNrmlMemModelBinSrch implements GenWord2VecModel {
private float[][] vecArr;
private int[] indxArr;
private double[] simValArr;
private int compareVecCount = 100;
private int compareVecCount = 150;
private int bucketCount = 10;
private BitSet[][] csBucketContainer;
// TODO : Remove this
Expand Down Expand Up @@ -176,7 +176,9 @@ private String getClosestEntry(float[] vector, String subKey) {
double cosSimVal = Word2VecMath.cosineSimilarityNormalizedVecs(curCompVec, vector);
int indx = getBucketIndex(cosSimVal);
BitSet curBs = new BitSet(word2vec.size());
curBs.or(csBucketContainer[i][indx]);
if(csBucketContainer[i][indx]!=null) {
curBs.or(csBucketContainer[i][indx]);
}
int temIndx = indx + 1;
if (temIndx < csBucketContainer[i].length && csBucketContainer[i][temIndx] != null) {
curBs.or(csBucketContainer[i][temIndx]);
Expand Down Expand Up @@ -209,8 +211,10 @@ private String getClosestEntry(float[] vector, String subKey) {
closestWord = findClosestWord(nearbyIndexes, vector);
tl.printTime(1, "finding closest word");
} catch (Exception e) {
LOG.error("Exception has occured while finding closest word.");
e.printStackTrace();
}
LOG.info("Closest word found is: "+closestWord);
return closestWord;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class W2VNrmlMemModelKMeans implements GenWord2VecModel {
private String[] wordArr;
private float[][] vecArr;
private int compareVecCount = 100;
private int bucketCount = 20;
private int bucketCount = 10;
private int kMeansMaxItr = 5;
private BitSet[][] csBucketContainer;
private String vecFilePath = "data/kmeans/comparison-vecs.csv";
Expand Down

0 comments on commit 7dcfff3

Please sign in to comment.