mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sean Owen <>
Subject Re: Save a UserSimilarity in a File
Date Thu, 17 May 2012 12:01:02 GMT
Yes I think you can and should certainly share a Recommender. It is
thread-safe. That wil in turn let you share data structures like
DataModel. Note you could run two different Recommenders from the same
shared DataModel if you wanted to, maybe to try two algorithms, but
that's not usual.

That's a separate question from how you handle similarities, and I
suggest you try caching in memory first to see if that gives you an
acceptable trade-off. You can pre-compute similarities if you want;
that's separate.

On Thu, May 17, 2012 at 12:57 PM, Nikolaos Romanos Katsipoulakis
<> wrote:
> On 05/17/2012 02:06 PM, Sean Owen wrote:
>> I think it will be way too slow to update a file like this, as you must
>> seek and rewrite the whole thing. Files aren't for this sort of update. A
>> DB might be.
>> Even if it were it is probably too slow to read the similarity from
>> backing
>> store each time. It needs to be mostly in memory. That's why the caching
>> wrapper is probably what you want.
>> Sean
>> On May 17, 2012 11:25 AM, "Nikolaos Romanos Katsipoulakis"<
>>>  wrote:
>>> Hey guys,
>>> In my recommender i need to save my UserSimilarity (CachingUserSimilarity
>>> to be exact) in a file, and whenever I get a request for a
>>> recommendation,
>>> i need to load it from a file, retrieve the recommendation, and then
>>> store
>>> it back in a file. Can this be done? I have seen in the mahout
>>> documentation a class FileItemSimilarity, which has a constructor that
>>> parses the FileItemSimilarity from a file. Is there a similar
>>> FileUserSimilarity? How is the FileItemSimilarity represented in the
>>> file?
>>> Thank you
> Thank you for your immediate answer. Hmm, I think you are right. The problem
> is that I want to maintain a static Recommender Object in a web service (and
> use it as a singleton for all invocations of the web service), that is
> updated asynchronously, and is persistent among all threads. Do you think
> that this is a more acceptable design in matter of performance?
> Thank you

View raw message