Jean-Francois Leveque

Passage de Set en List pour les ensembles de recommandations (suite) et piur l'e…

…nsemble des utilisateurs.
...@@ -18,7 +18,7 @@ public class ProcessingExpert { ...@@ -18,7 +18,7 @@ public class ProcessingExpert {
18 this.topSize = topSize; 18 this.topSize = topSize;
19 } 19 }
20 20
21 - public ProcessingRecommendations getRecommendations(Set<Long> userIds) { 21 + public ProcessingRecommendations getRecommendations(List<Long> userIds) {
22 ProcessingRecommendations processingRecommendations = new ProcessingRecommendations(); 22 ProcessingRecommendations processingRecommendations = new ProcessingRecommendations();
23 List<ScoredId> recommendations; 23 List<ScoredId> recommendations;
24 for (Long userId : userIds) { 24 for (Long userId : userIds) {
......
...@@ -11,9 +11,7 @@ import org.springframework.boot.ApplicationRunner; ...@@ -11,9 +11,7 @@ import org.springframework.boot.ApplicationRunner;
11 import org.springframework.stereotype.Component; 11 import org.springframework.stereotype.Component;
12 12
13 import java.io.*; 13 import java.io.*;
14 -import java.util.HashSet; 14 +import java.util.*;
15 -import java.util.Properties;
16 -import java.util.Set;
17 15
18 @Component 16 @Component
19 public class ProcessingRunner implements ApplicationRunner { 17 public class ProcessingRunner implements ApplicationRunner {
...@@ -46,7 +44,7 @@ public class ProcessingRunner implements ApplicationRunner { ...@@ -46,7 +44,7 @@ public class ProcessingRunner implements ApplicationRunner {
46 public void run(ApplicationArguments args) throws Exception { 44 public void run(ApplicationArguments args) throws Exception {
47 loadParameters(); 45 loadParameters();
48 logger.trace("Parameters loaded"); 46 logger.trace("Parameters loaded");
49 - Set<Long> userIds = loadUserIdsFromSample(); 47 + List<Long> userIds = loadUserIdsFromSample();
50 RecommenderFactory recommenderFactory = new RecommenderFactory(); 48 RecommenderFactory recommenderFactory = new RecommenderFactory();
51 recommender = recommenderFactory.build(algorithm ,dataDir+sampleFilename); 49 recommender = recommenderFactory.build(algorithm ,dataDir+sampleFilename);
52 logger.trace("Recommender built"); 50 logger.trace("Recommender built");
...@@ -57,8 +55,8 @@ public class ProcessingRunner implements ApplicationRunner { ...@@ -57,8 +55,8 @@ public class ProcessingRunner implements ApplicationRunner {
57 logger.trace("Recommendations written"); 55 logger.trace("Recommendations written");
58 } 56 }
59 57
60 - private Set<Long> loadUserIdsFromSample() throws ProcessingException { 58 + private List<Long> loadUserIdsFromSample() throws ProcessingException {
61 - Set<Long> userIds = new HashSet<>(); 59 + List<Long> userIds = new ArrayList<>();
62 60
63 Reader in = null; 61 Reader in = null;
64 try { 62 try {
...@@ -81,7 +79,7 @@ public class ProcessingRunner implements ApplicationRunner { ...@@ -81,7 +79,7 @@ public class ProcessingRunner implements ApplicationRunner {
81 CSVPrinter csvPrinter = new CSVPrinter(new FileWriter(new File(dataDir, recommandationsFilename)), 79 CSVPrinter csvPrinter = new CSVPrinter(new FileWriter(new File(dataDir, recommandationsFilename)),
82 CSVFormat.TDF.withHeader("itemId", "userId")); 80 CSVFormat.TDF.withHeader("itemId", "userId"));
83 // TODO : finish 81 // TODO : finish
84 - Set<RecommendationElement> recommendations = processingRecommendations.getRecommendations(); 82 + List<RecommendationElement> recommendations = processingRecommendations.getRecommendations();
85 if (recommendations.isEmpty()) { 83 if (recommendations.isEmpty()) {
86 logger.trace("No recommendations at all"); 84 logger.trace("No recommendations at all");
87 } else { 85 } else {
......