Hi,
I want to create recommendations for my customers based on boolean data.
Essencially whether they bought a product.
So this will create a csv containing:
acctId, itemId, 1
There is an entry in the CSV for each sale. So all entries will have a
'rating' of 1. Using the following example:
DataModel model = new FileDataModel(new File("data.txt"));
PearsonCorrelationSimilarity userSimilarity = new
PearsonCorrelationSimilarity(model);
userSimilarity.setPreferenceInferrer(new
AveragingPreferenceInferrer(model));
UserNeighborhood neighborhood =
new NearestNUserNeighborhood(1, userSimilarity, model);
Recommender recommender =
new GenericUserBasedRecommender(model, neighborhood,
userSimilarity);
Recommender cachingRecommender = new
CachingRecommender(recommender);
List<RecommendedItem> recommendations =
cachingRecommender.recommend("1967128", 10);
for (RecommendedItem item : recommendations) {
System.out.println(item);
}
I get 0 recommendations even when I have seeded the file with obvious
correlations. I'm guessing this is because all 'ratings' are 1. Is there any
way to infer that all other items have a rating of 0, thus giving the
algorithms something to correlate?
Thanks,
Paul
--
---------------------------------------------
Paul Loy
[email protected]
http://www.keteracel.com/paul