5 should get 107 as a recommendation, whether user-based or item-based. No clue why you're not getting it.
On Wed, Feb 12, 2014 at 11:50 PM, jiangwen jiang <jiangwen...@gmail.com>wrote: > Hi, all: > > I try to user mahout api to make recommendations, but I find some userId > has no recommendations, why? > > here is my code > public static void main(String args[]) throws Exception { > String inFile = "F:\\hadoop\\data\\recsysinput.txt"; > DataModel dataModel = new FileDataModel(new File(inFile)); > UserSimilarity userSimilarity = new > PearsonCorrelationSimilarity(dataModel); > UserNeighborhood userNeighborhood = new > NearestNUserNeighborhood(100, userSimilarity, dataModel); > Recommender recommender = new > GenericUserBasedRecommender(dataModel, userNeighborhood, userSimilarity); > > for (int i = 1; i <= 5; i++) { > List<RecommendedItem> recommendations = > recommender.recommend(i, 1); > > System.out.println("recommend for user:" + i); > for (RecommendedItem recommendation : recommendations) { > System.out.println(recommendation); > } > } > } > > > input data(recsysinput.txt): > 1,101,5.0 > 1,102,3.0 > 1,103,2.5 > 2,101,2 > 2,102,2.5 > 2,103,5 > 2,104,2 > 3,101,2.5 > 3,104,4 > 3,105,4.5 > 3,107,5 > 4,101,5 > 4,103,3 > 4,104,4.5 > 4,106,4 > 5,101,4 > 5,102,3 > 5,103,2 > 5,104,4 > 5,105,3.5 > 5,106,4 > > output: > recommend for user:1 > RecommendedItem[item:104, value:5.0] > recommend for user:2 > RecommendedItem[item:106, value:4.0] > recommend for user:3 > RecommendedItem[item:106, value:4.0] > recommend for user:4 > RecommendedItem[item:105, value:5.0] > recommend for user:5 > > UserId 5 has no recommendations, is it right? > Can I get some recommendations for userId 5, even if the recommendation > results are not good enough? > > thanks > Regards! >