ph34r
ph34r

Reputation: 93

Mahout Item-based recommendation engine with no preference values

I am trying to build a recommendation engine using Mahout that gives recommendations solely based on item-to-item similarity, not taking into account user preferences (i.e. ratings). The item similarities are calculated by some other process external to mahout and saved to a file. So far, I have determined that I can use the class:

GenericBooleanPrefItemBasedRecommender

...to pick items, which the documentation says is "appropriate for use when no notion of preference value exists in the data." However, the class still takes as input:

(DataModel dataModel, ItemSimilarity similarity)

I know I can use ItemSimilarity class to supply the item-to-item similarity value, but what is my datamodel in this case? I have no preferences, which seems to be the exact thing the datamodel represents. how do I work around this, or am I looking at the wrong thing here?

Upvotes: 2

Views: 1197

Answers (2)

Dragan Milcevski
Dragan Milcevski

Reputation: 776

Here is a simple code how you can create an instance of your DataModel that uses GenericBooleanPrefDataModel

DataModel model = new GenericBooleanPrefDataModel(GenericBooleanPrefDataModel.toDataMap(new FileDataModel(new File("YOUR_FILE_NAME"))));

However, even if you have data model with preference values, and you have custom implementation of ItemSimilarity that does not use this preference values, you will get the desired result.

Upvotes: 2

ssc
ssc

Reputation: 301

Simply use a GenericBooleanPrefDataModel.

Upvotes: 0

Related Questions