mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefano Bellasio <stefanobella...@gmail.com>
Subject Re: Grouplens dataset Recommenderjob with Hadoop
Date Sat, 20 Nov 2010 15:06:38 GMT
Something like this? And then i have to package it and use instead of Mahout-core..job right?
Thanks again

public class ItemBased implements Recommender {


		//private final Recommender delegate;
		private DataModel model; 
		
		public ItemBased(DataModel model) throws TasteException, IOException {
			
		ItemSimilarity similarity = new PearsonCorrelationSimilarity(model);	
		
		ItemBasedRecommender recommender = new GenericItemBasedRecommender(model, similarity);
		LoadEvaluator.runLoad(recommender);
		List<RecommendedItem> recommendations = recommender.recommend(1,1);
		
		
		for (RecommendedItem recommendation : recommendations){
			System.out.println(recommendation);
		}
}
		@Override
		public float estimatePreference(long userID, long itemID)
				throws TasteException {
			// TODO Auto-generated method stub
			return 0;
		}
		@Override
		public DataModel getDataModel() {
			// TODO Auto-generated method stub
			return null;
		}
		@Override
		public List<RecommendedItem> recommend(long userID, int howMany)
				throws TasteException {
			// TODO Auto-generated method stub
			return null;
		}
		@Override
		public List<RecommendedItem> recommend(long userID, int howMany,
				IDRescorer rescorer) throws TasteException {
			// TODO Auto-generated method stub
			return null;
		}
		@Override
		public void removePreference(long userID, long itemID)
				throws TasteException {
			// TODO Auto-generated method stub
			
		}
		@Override
		public void setPreference(long userID, long itemID, float value)
				throws TasteException {
			// TODO Auto-generated method stub
			
		}
		@Override
		public void refresh(Collection<Refreshable> alreadyRefreshed) {
			// TODO Auto-generated method stub
			
		}
Il giorno 20/nov/2010, alle ore 12.39, Sean Owen ha scritto:

> Look at Listing 5.5. This is the kind of wrapper you need. You can skip the
> no-arg constructor actually and just write the one that takes a DataModel,
> if I recall correctly. Just delegate the rest of the methods. Inside the
> constructor, build whatever recommender you want.
> 
> On Sat, Nov 20, 2010 at 11:30 AM, Stefano Bellasio <
> stefanobellasio@gmail.com> wrote:
> 
>> So for example i need to follow the same steps of Wikipedia example in
>> Mahout in Action? then package it and use with this? Please i need some info
>> just about the correct steps :) Thanks
>> 
>> 


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message