Reputation: 35
I need to make a recommendation system using mahout. My data has the following data pieces:
Using the code below:
UserBasedRecommender recommender;
int userId = 5;
try {
File file = new File(getClass().getResource("databaseFILE.csv").getFile());
DataModel dataModel = new FileDataModel(file);
UserSimilarity userSimilarity = new PearsonCorrelationSimilarity(dataModel);
UserNeighborhood userNeighborhood = new ThresholdUserNeighborhood(0.1, userSimilarity, dataModel);
recommender = new GenericUserBasedRecommender(dataModel, userNeighborhood, userSimilarity);
List<RecommendedItem> recommendations = recommender.recommend(userId, 5);
for (RecommendedItem recommendation : recommendations) {
System.out.println(recommendation);
}
} catch (IOException e) {
throw new RuntimeException(e.getMessage(), e);
} catch (TasteException e) {
throw new RuntimeException(e.getMessage(), e);
}
This gives an output for the itemID and its corresponding value, however I get no result for the brandID. Im not sure how I would change this so that the brandID can also be included within the data structure.
Thanks for any help :)
Upvotes: 0
Views: 47