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
<[email protected]> 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.
>

Reply via email to