There's no magic involved in precomputing item similarities, just setup
a recommender, ask it for similar items and store them somewhere:

DataModel dataModel = ...
ItemSimilarity similarity = new CachingItemSimilarity(...);
ItemBasedRecommender recommender = new
    GenericItemBasedRecommender(dataModel, similarity);

LongPrimitiveIterator itemIDs = dataModel.getItemIDs();
while (itemIDs.hasNext()) {
  long itemID = itemIDs.nextLong();
  for (RecommendedItem similarItem :
      recommender.mostSimilarItems(itemID, ...)) {
    // save similar item to a file or a database
  }
}

With a little bit of engineering, this code can also run multithreaded.

Best,
Sebastian


On 20.03.2012 07:25, Mridul Kapoor wrote:
> On 20 March 2012 11:24, Ted Dunning <ted.dunn...@gmail.com> wrote:
> 
>> Yes.  There is a sequential invocation as well.
>>
> 
> And pardon me for this, but I couldn't really get that, couldn't find it
> through Mahout in Action as well. Could someone point me to the job/class I
> should use to pre-compute item similarities -- in a way like *
> org.apache.mahout.cf.taste.hadoop.similarity.item.ItemSimilarityJob*
> but I really do not want to leverage hadoop right now -- and run it on a
> single machine
> 
> Thanks
> Mridul
>  **
> 

Reply via email to