@@ -85,7 +85,7 @@ public class Pipeline {
8585 private static String TOPIC_NAME = null ;
8686 // placeholder for the used dataset
8787 private final static String DATASET = "twitter" ;
88- private final static String SUBDIR = "/" ;
88+ private final static String SUBDIR = "/general/ " ;
8989
9090 public static void main (String [] args ) {
9191 System .out .println ("TagRecommender:\n " + "" +
@@ -105,7 +105,10 @@ public static void main(String[] args) {
105105 "-----------------------------------------------------------------------------\n \n " );
106106 String dir = DATASET + "_core" + SUBDIR ;
107107 String path = dir + DATASET + "_sample" ;
108- String networkFileName = "./data/csv/" + dir + "follow_nw.csv" ;
108+ String networkFileName = "./data/csv/" + dir + "network.txt" ;
109+
110+ // Test Social Recommender
111+ //startSocialRecommendation(dir, path, networkFileName);
109112
110113 //BibsonomyProcessor.processUnsortedFile("dc09_core/test_core/", "tas", "dc09_sample_test");
111114 //MovielensProcessor.processFile("000_dataset_dump/tags.dat", "000_dataset_dump/movielens", "000_dataset_dump/ratings.dat");
@@ -129,10 +132,8 @@ public static void main(String[] args) {
129132
130133 // Method Testing -> just uncomment the methods you want to test
131134 // Test the BLL and BLL+MP_r algorithms (= baseline to beat :))
132- startActCalculator (dir , path , 1 , -5 , -5 , true , CalculationType .NONE , false );
133-
134- // Test Social Recommender
135- startSocialRecommendation (dir , path , networkFileName );
135+ //startActCalculator(dir, path, 1, -5, -5, true, CalculationType.NONE, false);
136+
136137
137138 // Test the BLL_AC and BLL_AC+MP_r algorithms (could take a while)
138139 //startActCalculator(dir, path, 1, -5, 9, true, CalculationType.USER_TO_RESOURCE, false);
@@ -187,6 +188,7 @@ public static void main(String[] args) {
187188 System .out .println ("Too few arguments!" );
188189 return ;
189190 }
191+ String subdir = "/" ;
190192 String op = args [0 ];
191193 String samplePath = "" , sampleDir = "" ;
192194 int sampleCount = 1 ;
@@ -206,12 +208,17 @@ public static void main(String[] args) {
206208 sampleDir = "del_core" ;
207209 } else if (args [1 ].equals ("twitter" )){
208210 sampleDir = "twitter_core" ;
211+ } else if (args [1 ].equals ("twitter_res" )){
212+ sampleDir = "twitter_core" ;
213+ subdir = "/researchers" ;
214+ } else if (args [1 ].equals ("twitter_gen" )){
215+ sampleDir = "twitter_core" ;
216+ subdir = "/general" ;
209217 }
210218 else {
211219 System .out .println ("Dataset not available" );
212220 return ;
213221 }
214- String subdir = "/" ;
215222 sampleDir += subdir ;
216223 samplePath += (sampleDir + "/" + args [2 ]);
217224
@@ -299,7 +306,7 @@ public static void main(String[] args) {
299306 } else if (op .equals ("item_cirtt" )) {
300307 startResourceCIRTTCalculator (sampleDir , samplePath , "" , sampleCount , 20 , Features .ENTITIES , false , true , false , true );
301308 } else if (op .equals ("item_sustain" )) {
302- startSustainApproach (dir , path , 2.845 , 0.5 , 6.396 , 0.0936 , 0 , 0 , 20 , 0.5 );
309+ startSustainApproach (sampleDir , samplePath , 2.845 , 0.5 , 6.396 , 0.0936 , 0 , 0 , 20 , 0.5 );
303310 } else if (op .equals ("tag_all" )) {
304311 startAllTagRecommenderApproaches (sampleDir , samplePath , !narrowFolksonomy );
305312 } else if (op .equals ("tag_samples" )) {
@@ -309,13 +316,14 @@ public static void main(String[] args) {
309316 startSampleTagRecommenderApproaches (sampleDir , samplePath + "4" , !narrowFolksonomy );
310317 } else if (op .equals ("stats" )) {
311318 try { getStatistics (samplePath , false ); } catch (Exception e ) { e .printStackTrace (); }
312- } else if (op .equals ("social" )) {
313- startSocialRecommendation (dir , path , networkFileName );
314- analysisSocial (dir , path , networkFileName , "all" );
315- }else {
319+ } else if (op .equals ("social_rec" )) {
320+ startSocialRecommendation (sampleDir , samplePath , networkFileName );
321+ } else if (op .equals ("social_analysis" )) {
322+ analysisSocial (sampleDir , samplePath , networkFileName , "all" );
323+ }
324+ else {
316325 System .out .println ("Unknown operation" );
317326 }
318-
319327 }
320328
321329 // Tag Recommenders methods -----------------------------------------------------------------------------
@@ -391,28 +399,29 @@ private static void startActCalculator(String sampleDir, String sampleName, int
391399 }
392400 }
393401
394- private static void startSocialRecommendation (String sampleDir , String sampleName , String networkFilename ){
402+ private static void startSocialRecommendation (String sampleDir , String sampleName , String networkFilename ) {
395403 double beta = 0.5 ;
396404 double exponentSocial = 0.5 ;
397405 String [] algos = {"social_freq" , "social" , "hybrid" , "hybrid_freq" };
398406 getTrainTestSize (sampleName );
399- SocialCalculator calculator = new SocialCalculator (sampleName , networkFilename , TRAIN_SIZE , TEST_SIZE );
407+ SocialCalculator calculator = new SocialCalculator (sampleDir , sampleName , networkFilename , TRAIN_SIZE , TEST_SIZE );
400408 for (String algo : algos ){
401- String filename = "social" + beta + "_" + exponentSocial + "_" + algo ;
409+ String filename = "social" + beta + "_" + exponentSocial + "_" + algo ;
402410 calculator .predictSample (beta , exponentSocial , algo );
403411 writeMetrics (sampleDir , sampleName , filename , 1 , 10 , null , null , null );
404412 }
405413 }
406414
407415 private static void analysisSocial (String sampleDir , String sampleName , String networkFilename , String type ){
408- SocialCalculator calculator = new SocialCalculator (sampleName , networkFilename , TRAIN_SIZE , TEST_SIZE );
416+ getTrainTestSize (sampleName );
417+ SocialCalculator calculator = new SocialCalculator (sampleDir , sampleName , networkFilename , TRAIN_SIZE , TEST_SIZE );
409418 if (type .equals ("social" )){
410- new ProcessFrequencyRecencySocial (calculator .getUserTagTimes (), calculator .getNetwork ());
419+ new ProcessFrequencyRecencySocial (sampleDir , calculator .getUserTagTimes (), calculator .getNetwork ());
411420 }else if (type .equals ("personal" )){
412- new ProcessFrequencyRecency ().ProcessTagAnalytics (calculator .getUserTagTimes ());
421+ new ProcessFrequencyRecency ().ProcessTagAnalytics (sampleDir , calculator .getUserTagTimes ());
413422 }else if (type .equals ("all" )){
414- new ProcessFrequencyRecency ().ProcessTagAnalytics (calculator .getUserTagTimes ());
415- new ProcessFrequencyRecencySocial (calculator .getUserTagTimes (), calculator .getNetwork ());
423+ new ProcessFrequencyRecency ().ProcessTagAnalytics (sampleDir , calculator .getUserTagTimes ());
424+ new ProcessFrequencyRecencySocial (sampleDir , calculator .getUserTagTimes (), calculator .getNetwork ());
416425 }
417426 }
418427
0 commit comments