@@ -251,7 +251,7 @@ public static double getLAverage(List<Map<Integer, Integer>> neighborMaps) {
251251
252252 private static String timeString ;
253253
254- private static List <Map <Integer , Double >> startBM25CreationForTagPrediction (BookmarkReader reader , int sampleSize , boolean userBased , boolean resBased , int beta ) {
254+ private static List <Map <Integer , Double >> startBM25CreationForTagPrediction (BookmarkReader reader , int sampleSize , boolean userBased , boolean resBased , int beta , boolean ignoreResource ) {
255255 int size = reader .getBookmarks ().size ();
256256 int trainSize = size - sampleSize ;
257257 Stopwatch timer = new Stopwatch ();
@@ -266,7 +266,8 @@ private static List<Map<Integer, Double>> startBM25CreationForTagPrediction(Book
266266 for (int i = trainSize ; i < size ; i ++) {
267267 Bookmark data = reader .getBookmarks ().get (i );
268268 Map <Integer , Double > map = null ;
269- map = calculator .getRankedTagList (data .getUserID (), data .getResourceID (), true );
269+ int resID = (ignoreResource ? -1 : data .getResourceID ());
270+ map = calculator .getRankedTagList (data .getUserID (), resID , true );
270271 results .add (map );
271272 //System.out.println(data.getTags() + "|" + map.keySet());
272273 }
@@ -277,12 +278,12 @@ private static List<Map<Integer, Double>> startBM25CreationForTagPrediction(Book
277278 return results ;
278279 }
279280
280- public static BookmarkReader predictTags (String filename , int trainSize , int sampleSize , int neighbors , boolean userBased , boolean resBased , int beta ) {
281+ public static BookmarkReader predictTags (String filename , int trainSize , int sampleSize , int neighbors , boolean userBased , boolean resBased , int beta , boolean ignoreResource ) {
281282 MAX_NEIGHBORS = neighbors ;
282- return predictSample (filename , trainSize , sampleSize , userBased , resBased , beta );
283+ return predictSample (filename , trainSize , sampleSize , userBased , resBased , beta , ignoreResource );
283284 }
284285
285- public static BookmarkReader predictSample (String filename , int trainSize , int sampleSize , boolean userBased , boolean resBased , int beta ) {
286+ public static BookmarkReader predictSample (String filename , int trainSize , int sampleSize , boolean userBased , boolean resBased , int beta , boolean ignoreResource ) {
286287 Timer timerThread = new Timer ();
287288 MemoryThread memoryThread = new MemoryThread ();
288289 timerThread .schedule (memoryThread , 0 , MemoryThread .TIME_SPAN );
@@ -291,7 +292,7 @@ public static BookmarkReader predictSample(String filename, int trainSize, int s
291292 reader .readFile (filename );
292293
293294 List <Map <Integer , Double >> cfValues = null ;
294- cfValues = startBM25CreationForTagPrediction (reader , sampleSize , userBased , resBased , beta );
295+ cfValues = startBM25CreationForTagPrediction (reader , sampleSize , userBased , resBased , beta , ignoreResource );
295296
296297 List <int []> predictionValues = new ArrayList <int []>();
297298 for (int i = 0 ; i < cfValues .size (); i ++) {
0 commit comments