mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Owen <sro...@gmail.com>
Subject Re: Mahout and DAO connection
Date Fri, 27 Nov 2009 00:57:43 GMT
I'm not clear what you mean. There are user-based and item-based
recommenders. Both recommend items to users. You had expressed
interest in recommending users to items. That could be done with a
user-based or item-based recommender, by flipping user and item IDs.

Which one(s) are and aren't working exactly? You show a user-based
recommender below, but can't tell whether you mean this works or
doesn't.

Also I am not sure what's going on in WorkDataModel. Have you
'flipped' user and item IDs there or no?

Last you say you are trying to recommend items to users, and that's an
issue, but I thought you had that working.

Back up a bit and clarify what the situation is.

(PS I wouldn't use a preference inferrer unless you know for sure it's
beneficial. It usually isn't.)

On Fri, Nov 27, 2009 at 12:51 AM, Johan Fredholm
<johan.fredholm@gmail.com> wrote:
> Thanks for the help.
> I got the recommender based on items to work, but I cant seem to get
> the recommender based on users to work.
> I don't get any errors, I just don't get any results.
>
> My call>
> -----------------
> WorkDataModel model = new WorkDataModel(accountDAO, arrangementDAO,
> reviewDAO, arrangements);
> UserSimilarity userSimilarity = new PearsonCorrelationSimilarity(model);
> userSimilarity.setPreferenceInferrer(new AveragingPreferenceInferrer(model));
> NearestNUserNeighborhood  neighborhood =  new NearestNUserNeighborhood
> (3, userSimilarity, model);
> GenericUserBasedRecommender recommender = new
> GenericUserBasedRecommender(model, neighborhood, userSimilarity);
> List<RecommendedItem> recommendations =
> recommender.recommend(account.getId(), amount);
> ------------------
>
> It looks like WorkDataModel returns everything correctly.
> This is my test:
>
> ------------------
> List<Arrangement> allReady = arrangementDAO.getAllReady();
>
> Account ac1 = accountDAO.get(22L);
> Account ac2 = accountDAO.get(21L);
> Account ac3 = accountDAO.get(23L);
>
> int i = 0;
> Arrangement aSearch = null;
>
> for (Arrangement a : allReady) {
>
>        if (i < 8) {
>                reviewDAO.save(new Review(a, ac1, 4F, Reviewtype.HUMAN));
>        }
>        if (i > 3) {
>                reviewDAO.save(new Review(a, ac2, 2F, Reviewtype.HUMAN));
>        }
>        if (i > 6 && i < 16) {
>                reviewDAO.save(new Review(a, ac3, 5F, Reviewtype.HUMAN));
>        }
>
>        if (i == 5) {
>                aSearch = a;
>        }
>
>        if (i > 15) {
>                break;
>        }
>
>        i++;
> }
>
> List<Arrangement> recommendations =
> arrangementService.getRecommendations(ac1, allReady, 10);
> -------------------
>
> I'm not really sure what I am sending in there, I'm just trying to mix
> it up a bit :-)
> I have tried to get recommendations from for all three of the accounts
> (users), but I don't get anything.
> Do I need more preferences, or is something else wrong?? The
> preferences are not overlapping, so shouldn't I get some kind of
> result back?
>
> Thanks!
> Johan
>
>
> On Thu, Nov 26, 2009 at 12:02 PM, Sean Owen <srowen@gmail.com> wrote:
>> Yes everything looks fine here, but with one key issue.
>> It seems you are trying to recommender "users" to "items" in the
>> second case. That is not what an item-based recommender does -- it
>> still recommenders items to users.
>>
>> To do what you want, you need to transpose user and item IDs in your
>> DataModel, then use any algorithm you like. It's a two-line change to
>> the line where you make a GenericPreference. Maybe create a flag in
>> the constructor that controls this so you can reuse the model in both
>> cases.
>>
>> It does mean you need a separate model, yes.
>>
>> PS I think your model-building will use a lot of memory at peak --
>> that map of Collection<Preference> will be a lot bigger than the final
>> data set. You can instead build PreferenceArray directly, note.
>>
>> On Thu, Nov 26, 2009 at 9:38 AM, Johan Fredholm
>> <johan.fredholm@gmail.com> wrote:
>>> Hi,
>>> I have been trying to configure Mahout for using hibernate. I haven't
>>> been able to find any examples of such a configuration. Its probably
>>> the wrong way to do it but I cant even get this simple model to work.
>>> It would be great if you could tell me what I'm doing wrong here, and
>>> maybe some pointers on how it should be done.
>>>
>>
>

Mime
View raw message