On Sun, Mar 28, 2010 at 11:12 PM, seda <[email protected]> wrote: > In the recommend method, i get two recommendation for the user which has 1 > as a userID. But how can i know these recommendations related with which > itemIDs? User1 does not have recommendation for item2,3,4 and 5. So how can > I reach a recommend for User1 to specifically Item4 ?
In general, recommendations aren't 'caused' by a particular item. They're a function of all preferences in the model. In the particular case of user-based recommenders, you might say that recommendations are 'caused' by the neighborhood of users. You could examine the neighborhood from NearestNUserNeighborhood for user 1 to understand what it is computing as similar users. In this case, the neighborhood of two users is user 2 and user 5. You could ask for more recommended items here (the second argument to recommend()). In general that's how you get farther down the list of recommendations. Here, the top recommendations are items 3 and 2. But here, actually, you'll never be recommended items 4 and 5. This gets slightly hard to explain. In the neighborhood (users 2 and 5), only one user has any preference for items 4 and 5 -- user 5. An item only preferred by one other user won't be recommended by a user-based recommender, at least as implemented here. The reasoning is that the estimated preference, which is computed as a weighted average, is based on only one data point, and the weight -- the preference value -- actually doesn't matter at all. That's not good. The framework won't proceed in that case. If you expanded the neighborhood to 3 users, you would probably see another item. But all of these are really quirks that you see on really small or sparse data sets -- or contrived unit test examples. This isn't much of an issue in practice. Look at TopItems.getTopItems(), which is where the recommendations are really selected. > Besides in your example datasets, what if user5 does not have recommendation > for item3(0.7), how can you represent it, as a zero? In this little test framework, pass null to mean "no preference". 0.0 means "preference, with rating 0".
