Skip to content

Commit 000f50e

Browse files
author
jseagull
committed
fix sparsejstest
1 parent a92fee4 commit 000f50e

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

src/main/java/com/guokr/simbase/store/Recommendation.java

+7-8
Original file line numberDiff line numberDiff line change
@@ -118,17 +118,16 @@ private void processDeletedEvt(int tgtVecId) {
118118
}
119119
}
120120

121-
public Sorter create(int srcVecId) {
122-
Sorter sorter = new Sorter(scoring.order(), this.limit);
123-
this.sorters.put(srcVecId, sorter);
124-
this.sorterKeys.add(srcVecId);
125-
return sorter;
121+
public void create(int srcVecId) {
122+
if (!sorters.containsKey(srcVecId)) {
123+
Sorter sorter = new Sorter(scoring.order(), this.limit);
124+
this.sorters.put(srcVecId, sorter);
125+
this.sorterKeys.add(srcVecId);
126+
}
126127
}
127128

128129
public void add(int srcVecId, int tgtVecId, float score) {
129-
if (!sorters.containsKey(srcVecId)) {
130-
create(srcVecId);
131-
}
130+
create(srcVecId);
132131
this.sorters.get(srcVecId).add(tgtVecId, score);
133132
if (!this.reverseIndexer.containsKey(tgtVecId)) {
134133
this.reverseIndexer.put(tgtVecId, new TIntArrayList());

src/tests/java/com/guokr/simbase/engine/SparseJSComplexTests.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public static void setup() throws Exception {
2222
Map<String, Object> basis = new HashMap<String, Object>();
2323
Map<String, Object> sparse = new HashMap<String, Object>();
2424
Map<String, Object> econf = new HashMap<String, Object>();
25-
sparse.put("accumuFactor", 0.01);
25+
sparse.put("accumuFactor", 0.5);
2626
sparse.put("sparseFactor", 2048);
2727
basis.put("vectorSetType", "sparse");
2828
econf.put("savepath", "data");

0 commit comments

Comments
 (0)