I'm working on the implementation of a recommendation algorithm with a "special" feature and I would like to perform just this small customization on basic algorithms provided by Apache Mahout.
These are the steps I'm following (*=non-basic steps):
- create a DataModel:
DataModel userModel = new GenericDataModel(userItemPreference);
- compute similarity:
UserSimilarity euclideanDistanceUserSimilarity = new EuclideanDistanceSimilarity(userModel);
- get basic neighborhood
UserNeighborhood e_n_neighborhood = new NearestNUserNeighborhood(20, euclideanDistanceUserSimilarity, userModel);
- compute a "weight" value for any of these user (*)
- change the similarity of users inside neighorhood using weighted values (e.g.
similarity*=weight
) (*) - get a sub neighborhood containing only the 10 high-weighted-related users (*)
- get a recommendation using only this new neighborhood (*)
It should be very simple, but I don't understand why, to build a Recommender, Mahout need for userModel, neighborhood and distanceSimilarity again)... so I can't figure which object I need to modify and pass to the constructor (new neighborhood apart).
UserBasedRecommender t_recommender =
new GenericUserBasedRecommender(userModel, e_n_neighborhood,
euclideanDistanceUserSimilarity, null);
Do you have any suggestion to help me to implement steps 5 and 7 (considering the GenericUserBasedRecommender
concerns I just spoke about)?
Thank you