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 {
this.topSize = topSize;
}
public ProcessingRecommendations getRecommendations(Set<Long> userIds) {
public ProcessingRecommendations getRecommendations(List<Long> userIds) {
ProcessingRecommendations processingRecommendations = new ProcessingRecommendations();
List<ScoredId> recommendations;
for (Long userId : userIds) {
......
......@@ -11,9 +11,7 @@ import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import java.io.*;
import java.util.HashSet;
import java.util.Properties;
import java.util.Set;
import java.util.*;
@Component
public class ProcessingRunner implements ApplicationRunner {
......@@ -46,7 +44,7 @@ public class ProcessingRunner implements ApplicationRunner {
public void run(ApplicationArguments args) throws Exception {
loadParameters();
logger.trace("Parameters loaded");
Set<Long> userIds = loadUserIdsFromSample();
List<Long> userIds = loadUserIdsFromSample();
RecommenderFactory recommenderFactory = new RecommenderFactory();
recommender = recommenderFactory.build(algorithm ,dataDir+sampleFilename);
logger.trace("Recommender built");
......@@ -57,8 +55,8 @@ public class ProcessingRunner implements ApplicationRunner {
logger.trace("Recommendations written");
}
private Set<Long> loadUserIdsFromSample() throws ProcessingException {
Set<Long> userIds = new HashSet<>();
private List<Long> loadUserIdsFromSample() throws ProcessingException {
List<Long> userIds = new ArrayList<>();
Reader in = null;
try {
......@@ -81,7 +79,7 @@ public class ProcessingRunner implements ApplicationRunner {
CSVPrinter csvPrinter = new CSVPrinter(new FileWriter(new File(dataDir, recommandationsFilename)),
CSVFormat.TDF.withHeader("itemId", "userId"));
// TODO : finish
Set<RecommendationElement> recommendations = processingRecommendations.getRecommendations();
List<RecommendationElement> recommendations = processingRecommendations.getRecommendations();
if (recommendations.isEmpty()) {
logger.trace("No recommendations at all");
} else {
......