Reputation: 184
I've followed this tutorial :
https://ademsha.com/notes/developing-recommendation-system-with-apache-mahout/
It worked fine with ml-100k dataset, but when I added more evaluations to the u.data
file (using exactly the same format userId, itemId, rating, timestamp
), I get the following error:
[main] INFO org.apache.mahout.cf.taste.impl.model.file.FileDataModel - Creating FileDataModel for file u.data
Exception in thread "main" java.lang.IllegalArgumentException: Did not find a delimiter in first line
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.determineDelimiter(FileDataModel.java:351)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.<init>(FileDataModel.java:201)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.<init>(FileDataModel.java:169)
at org.apache.mahout.cf.taste.impl.model.file.FileDataModel.<init>(FileDataModel.java:149)
at teste.HelloMaven.SimpleRec.main(SimpleRec.java:20)
The code is this :
public class SimpleRec {
public static void main(String[] args) throws Exception {
DataModel model = new FileDataModel(new File("u.data"));
UserSimilarity similarity = new PearsonCorrelationSimilarity(model);
UserNeighborhood neighborhood = new ThresholdUserNeighborhood(0.5, similarity, model);
Recommender recommender = new GenericUserBasedRecommender(model,neighborhood, similarity);
List<RecommendedItem> recomendations = recommender.recommend(943,5);
for (RecommendedItem recomendation : recomendations) {
System.out.println(recomendation);
}
}
}
Upvotes: 1
Views: 493