Skip to content

Commit acf3b93

Browse files
committed
bugfix
1 parent 2fbbb90 commit acf3b93

File tree

7 files changed

+13
-12
lines changed

7 files changed

+13
-12
lines changed

src/engine/CFResourceRecommenderEngine.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,7 @@ public void loadFile(String filename) throws Exception {
4747

4848
BookmarkReader reader = new BookmarkReader(0, false);
4949
reader.readFile(filename);
50-
5150
Collections.sort(reader.getBookmarks());
52-
//System.out.println("read in and sorted file");
5351

5452
BM25Calculator calculator = new BM25Calculator(reader, reader.getBookmarks().size(), false, true, false, 5, Similarity.COSINE, Features.ENTITIES);
5553

src/engine/EngineUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ License, or (at your option) any later version.
3030

3131
public class EngineUtils {
3232

33+
public static void logRecommendationCall() {
34+
35+
}
36+
3337
public static Map<String, Double> calcTopTags(BookmarkReader reader) {
3438
Map<String, Double> tagMap = new LinkedHashMap<>();
3539
Map<Integer, Integer> countMap = new LinkedHashMap<Integer, Integer>();

src/engine/TagRecommenderEngine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public void loadFile(String filename) throws Exception {
5959
}
6060

6161
@Override
62-
public Map<String, Double> getEntitiesWithLikelihood(String user, String resource, List<String> topics, Integer count) {
62+
public synchronized Map<String, Double> getEntitiesWithLikelihood(String user, String resource, List<String> topics, Integer count) {
6363
if (topics != null && topics.size() > 0 && this.threelEngine != null) {
6464
return this.threelEngine.getEntitiesWithLikelihood(user, resource, topics, count);
6565
} else if (this.bllEngine != null) {

src/engine/ThreeLayersEngine.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ public void loadFile(String filename) throws Exception {
4949
Collections.sort(reader.getBookmarks());
5050
//System.out.println("read in and sorted file");
5151

52-
ThreeLayersCalculator calculator = new ThreeLayersCalculator(reader, reader
53-
.getBookmarks().size(), 5, 5, true, true, false);
52+
ThreeLayersCalculator calculator = new ThreeLayersCalculator(reader, reader.getBookmarks().size(), 5, 5, true, true, false);
5453

5554
resetStructure(reader, calculator);
5655
}

src/file/PredictionFileReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public boolean readFile(String filename, int k, BookmarkReader wikiReader, Integ
9090
this.predictions.add(null);
9191
}
9292
}
93-
if (k == 1) {
93+
if (k == 20) {
9494
System.out.println("Number of users to predict: " + this.predictions.size());
9595
}
9696
br.close();

src/processing/MetricsCalculator.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ public MetricsCalculator(PredictionFileReader reader, String outputFile, int k,
7070
BufferedWriter bw = null;
7171
boolean recommTags = (reader == null);
7272
// TODO: Enable if you need data for statistical tests
73-
/*if (k == 5 || k == 10) {
73+
if (k == 20) {
7474
try {
7575
FileWriter writer = new FileWriter(new File(outputFile + "_" + k + ".txt"), true);
7676
bw = new BufferedWriter(writer);
7777
} catch (Exception e) {
7878
e.printStackTrace();
7979
}
80-
}*/
80+
}
8181

8282
//double count = this.reader.getPredictionCount(); // only user where there are recommendations
8383
double count = this.reader.getPredictionData().size(); // all users
@@ -150,15 +150,15 @@ public MetricsCalculator(PredictionFileReader reader, String outputFile, int k,
150150
this.nDCG = nDCG / count;
151151

152152
// TODO: enable in case statistics are needed
153-
/*if (bw != null) {
153+
if (bw != null) {
154154
try {
155155
//bw.write("\n");
156156
bw.flush();
157157
bw.close();
158158
} catch (Exception e) {
159159
e.printStackTrace();
160160
}
161-
}*/
161+
}
162162
}
163163

164164
public double getRecall() {

src/test/Pipeline.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ public class Pipeline {
7272
// set for categorizer/describer split (true is describer, false is categorizer - null for nothing)
7373
private final static Boolean DESCRIBER = null;
7474
// placeholder for the topic posfix
75-
private static String TOPIC_NAME = "lda_500";
75+
private static String TOPIC_NAME = null;
7676
// placeholder for the used dataset
77-
private final static String DATASET = "lastfm";
77+
private final static String DATASET = "del";
7878

7979
public static void main(String[] args) {
8080
System.out.println("TagRecommender:\n" + "" +

0 commit comments

Comments
 (0)