mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Pullara <...@sampullara.com>
Subject Sometimes empty results
Date Mon, 02 May 2011 04:27:13 GMT
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
View raw message