Jia
Jia

Reputation: 1321

Extend Mahout for new dataset

I want to build a recommendation model based on Mahout. My dataset format has extra columns other than userID, itemID, rating and timestamp. Thus, I think I need to extend the FileDataModel.

I looked into JesterDataModel as an example. However, I have a problem with the logic flow. In its buildModel() method, an empty map "data" is first constructed. It is then thrown into processFile. I assume that "data" is modified in this method, since later it is used to construct the GenericDataModel However, data is a local variable instead of a class variable, so how is it modified?

processFile(iterator, data, timestamps, false);
return new GenericDataModel(GenericDataModel.toDataMap(data, true));

Upvotes: 1

Views: 310

Answers (1)

Julian Ortega
Julian Ortega

Reputation: 947

I see... I believe you would have to rewrite major parts like DataModel, Similarities calculation, and so on and so on, to make that work. You can look at the Rescorer which allows you to introduce your own logic and filter items out or boost some other items based on your requirements.

In chapter 5 of the Mahout in Action book there is an example of how to use the Rescorer class. You can see the code here (link)

Upvotes: 1

Related Questions