You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@mahout.apache.org by Winnu Ayi Satria <wi...@gmail.com> on 2012/08/01 21:37:13 UTC

MongoDBDataModel doesn't work?

Hi all,

I am trying to combine MongoDB and Mahout using the same code in Mahout In
Action book, chapter 2. The very first code. But now I replaced the source,
user-item-preference, not from CSV file but from MongoDB. So the model is
instantiated from MongoDBDataModel, not FileDataModel anymore. The CSV file
has been copied to MongoDB. Everything is same, except how to create the
model.

However, it doesn't work. The UserSimilarity class can not generate
similarity table from the data model. I checked the data inside the
instantiated model, and yes, all users, items, and preference do exist. Is
there something problem with MongoDBDataModel and UserSimilarity?

I also tried the sample from here,
http://www.smartlab.at/articles/recommendation-engine/, that uses
SVDRecommender and it works.

Too bad, not so many example or reference about MongoDBDataModel in
internet while combining Mahout and MongoDB would be interesting.

Anyone has ever experienced with this problem?

-- 
Best regards,

Winnu Ayi Satria

Re: MongoDBDataModel doesn't work?

Posted by Winnu Ayi Satria <wi...@gmail.com>.
After checking through debugger, I could confirm using the simple code from
Mahout In Action book and MongoDBDataModel, it works. Actually it is
trivial problem, the actual userID in MongoDB or CSV file is different with
userID inside MongoDBDataModel. So is the itemID.

for example:

recommendation:RecommendedItem[item:*5*, value:4.257081]
recommendation:RecommendedItem[item:*10*, value:4.0]

itemID has been changed. not [101-107] anymore.

Using sample code from the internet link I pasted before must be handled
with thoroughly while it looks like show no similarity (similarity=NaN)
among the users and (SVDRecommender might be the appropriate
solution). That iss why I totally lost.

Okay, thanks for the suggestion. :)

On Wed, Aug 1, 2012 at 9:43 PM, Sean Owen <sr...@gmail.com> wrote:

> If the data is 'really' there in the DataModel you seem to have ruled
> out all the differences. ;) I imagine there is something slightly
> amiss. Can you step through with a debugger to see what the
> UserSimilarity calculates? look what data it gets and see if it makes
> sense. If it seems to, double-check against FileDataModel. If you can
> say more about the difference maybe I can offer a better guess.
>
> The Mongo-backed class is a bit of a toy. It loads all the data in
> memory. While that's handy just insofar as it lets you consume data
> that happens to be in Mongo, it's not any more scalable than something
> backed by a file.
>
> Anything real-time has to be in memory, really.  Anything not
> real-time -- doesn't matter where your data is put since you're likely
> distributing with something like Hadoop, which consumes data in a
> linear and leisurely way.
>
>
> On Wed, Aug 1, 2012 at 8:37 PM, Winnu Ayi Satria <wi...@gmail.com>
> wrote:
> > Hi all,
> >
> > I am trying to combine MongoDB and Mahout using the same code in Mahout
> In
> > Action book, chapter 2. The very first code. But now I replaced the
> source,
> > user-item-preference, not from CSV file but from MongoDB. So the model is
> > instantiated from MongoDBDataModel, not FileDataModel anymore. The CSV
> file
> > has been copied to MongoDB. Everything is same, except how to create the
> > model.
> >
> > However, it doesn't work. The UserSimilarity class can not generate
> > similarity table from the data model. I checked the data inside the
> > instantiated model, and yes, all users, items, and preference do exist.
> Is
> > there something problem with MongoDBDataModel and UserSimilarity?
> >
> > I also tried the sample from here,
> > http://www.smartlab.at/articles/recommendation-engine/, that uses
> > SVDRecommender and it works.
> >
> > Too bad, not so many example or reference about MongoDBDataModel in
> > internet while combining Mahout and MongoDB would be interesting.
> >
> > Anyone has ever experienced with this problem?
> >
> > --
> > Best regards,
> >
> > Winnu Ayi Satria
>



-- 
Best regards,

Winnu Ayi Satria

Re: MongoDBDataModel doesn't work?

Posted by Sean Owen <sr...@gmail.com>.
If the data is 'really' there in the DataModel you seem to have ruled
out all the differences. ;) I imagine there is something slightly
amiss. Can you step through with a debugger to see what the
UserSimilarity calculates? look what data it gets and see if it makes
sense. If it seems to, double-check against FileDataModel. If you can
say more about the difference maybe I can offer a better guess.

The Mongo-backed class is a bit of a toy. It loads all the data in
memory. While that's handy just insofar as it lets you consume data
that happens to be in Mongo, it's not any more scalable than something
backed by a file.

Anything real-time has to be in memory, really.  Anything not
real-time -- doesn't matter where your data is put since you're likely
distributing with something like Hadoop, which consumes data in a
linear and leisurely way.


On Wed, Aug 1, 2012 at 8:37 PM, Winnu Ayi Satria <wi...@gmail.com> wrote:
> Hi all,
>
> I am trying to combine MongoDB and Mahout using the same code in Mahout In
> Action book, chapter 2. The very first code. But now I replaced the source,
> user-item-preference, not from CSV file but from MongoDB. So the model is
> instantiated from MongoDBDataModel, not FileDataModel anymore. The CSV file
> has been copied to MongoDB. Everything is same, except how to create the
> model.
>
> However, it doesn't work. The UserSimilarity class can not generate
> similarity table from the data model. I checked the data inside the
> instantiated model, and yes, all users, items, and preference do exist. Is
> there something problem with MongoDBDataModel and UserSimilarity?
>
> I also tried the sample from here,
> http://www.smartlab.at/articles/recommendation-engine/, that uses
> SVDRecommender and it works.
>
> Too bad, not so many example or reference about MongoDBDataModel in
> internet while combining Mahout and MongoDB would be interesting.
>
> Anyone has ever experienced with this problem?
>
> --
> Best regards,
>
> Winnu Ayi Satria