mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steven Bourke <sbou...@gmail.com>
Subject Re: Sometimes empty results
Date Mon, 02 May 2011 08:38:31 GMT
Nope, no randomness, the liklihood is that a recommendation cannot be made
for the user you are making a request for. You could use the random
recommender or just return the top 10 items from the dataset.

On Mon, May 2, 2011 at 5:27 AM, Sam Pullara <sam@sampullara.com> wrote:

> I'm using this structure for my code:
>
>    FastByIDMap<FastIDSet> userData = new FastByIDMap<FastIDSet>();
>    for (Row<Profile, byte[]> profileRow : profiles.scan(null, null)) {
>      if (profileRow != null) {
>        byte[] row = reverse(profileRow.row);
>        long userid = parseLong($_(row));
>        FastIDSet fastIDSet = new FastIDSet();
>        for (Utf8 utf8 : n(profileRow.value.bags())) {
>          Row<Bag, byte[]> bagRow = bagService.lookup(utf8.toString());
>          if (bagRow != null && n(bagRow.value.published())) {
>            for (BaggedItem bi : n(bagRow.value.items())) {
>              long itemid = reverseKey(bi.id());
>              fastIDSet.add(itemid);
>            }
>          }
>        }
>        if (fastIDSet.size() > 0) {
>          userData.put(userid, fastIDSet);
>        }
>      }
>    }
>    final DataModel model = new GenericBooleanPrefDataModel(userData);
>    UserSimilarity similarity = new LogLikelihoodSimilarity(model);
>    UserNeighborhood neighborhood = new NearestNUserNeighborhood(10,
> similarity, model);
>    final Recommender recommender = new GenericUserBasedRecommender(model,
> neighborhood, similarity);
>    List<RecommendedItem> recommendations =
> recommender.recommend(reverseKey(id), 3);
>
> Running this with identical input can sometimes return good recommendations
> and other times return nothing. Is there any randomness in the
> recommendations?
>
> Thanks,
> Sam
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message