mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mridul Kapoor <mridulkap...@gmail.com>
Subject Re: MongoDBDataModel in memory ?
Date Tue, 20 Mar 2012 09:56:25 GMT
On 20 March 2012 15:21, Sebastian Schelter <ssc@apache.org> wrote:

> 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


Did a bit of exploring. Could I just do this instead. I mean this would
obviously just save to a file instead of a database which might instead be
better for larger data. But is the following ok ?

$ bin/mahout itemsimilarity --input ~/path/to/preferences.csv --output
~/path/to/output --similarityClassname SIMILARITY_LOGLIKELIHOOD
--maxSimilaritiesPerItem 10 --tempDir ~/path/to/temp

Thanks
Mridul

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