mahout-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ryan Shih <ryan.s...@gmail.com>
Subject Re: Problem building Taste grouplens Demo
Date Sat, 07 Mar 2009 09:39:06 GMT
Hi Matt - This is actually the result of a code problem. For this example,
it picks up your data files fine (you'll be able to verify this by taking a
look in your temp directory on Tomcat because it will write files like
taste.movies.txt and taste.ratings.txt that hold your GLF converted file
after it reads it in from your classpath). However, the example currently
has logic that will look for additional files with the same prefix as
updates to your data. This fails, however because while taste.ratings.txt is
a valid ratings file, it reads taste.movies.txt as an an additional update
file but it's not and it fails to parse correctly. At the moment, it doesn't
appear like there is a way to override this because it's hardcoded so you'll
probably have to patch your file and rebuild.

A quick & dirty approach that I got to work for me is by editing the
following file & patch the following line.
src/main/java/org/apache/mahout/cf/taste/example/grouplens/GroupLensDataModel.java


-                                     "taste." + (ratings ? "ratings" :
"movies") + ".txt");
+                                     (ratings ? "ratings" : "movies") +
".txt");

This will still allow updates, but you'll have to add them something along
the lines of movies.1.txt, ratings.1.txt, etc.

If you get it all working, it'll take a short bit for it to do its magic and
you'll probably get results that look like for the following request:
http://localhost:8080/mahout-taste-webapp-0.1/RecommenderServlet?userID=1

7.321730220075736	557
5.248598816436773	53
5.117761222300874	1149
5.047946449451862	1039
5.0	3382
5.0	3607
5.0	989
5.0	3172
5.0	3656
5.0	1830
5.0	3881
5.0	572
5.0	3280
5.0	134
4.999999999999999	3233
4.98947269776999	3338
4.9753097928830785	3245
4.963755978247806	2503
4.917827198841746	2931
4.906247023765473	2930


Note that I'm building off of 0.1, but you'll see that the code problem
still exists in the most recent pull of trunk as of 3/7.

Ryan

On Thu, Mar 5, 2009 at 10:42 AM, Matthew Roberson <recom.team@gmail.com>wrote:

> The data files appear to be there:
>
> WEB-INF/classes/org/apache/mahout/cf/taste/example/grouplens/movies.dat
> WEB-INF/classes/org/apache/mahout/cf/taste/example/grouplens/ratings.dat
>
> -- Matt
>
>
> On Thu, Mar 5, 2009 at 9:53 AM, Sean Owen <srowen@gmail.com> wrote:
>
> > What this suggests to me actually is that the 'movies.dat' file isn't
> > present or is otherwise not quite all there... the data file seems to
> > be being read but it's got a reference to a movie that doesn't exist,
> > somehow.
> >
> > Is movies.dat in place and getting packaged up? try "jar tf" on the
> > .war file to see its contents.
> >
> > The data files are expected under
> > /org/apache/mahout/cf/taste/example/grouplens/
> >
> >
> >
> > On Thu, Mar 5, 2009 at 2:49 AM, Matthew Roberson <recom.team@gmail.com>
> > wrote:
> > > So...
> > >
> > > I placed the GroupLens data files in the following directory:
> > >
> >
> /Mahout/trunk/examples/src/main/java/org/apache/mahout/cf/taste/example/grouplens
> > >
> > > I ran mvn package.
> > >
> > > I then set the path for recommender class in web.xml to poin to
> > > GroupLensRecommender.
> > >
> > > I then deploy the following war file in Tomcat:
> > > mahout-taste-webapp-0.2-SNAPSHOT.war (located in
> > > Mahout/trunk/taste-web/target)
> > >
> > > I then type in browser: http://localhost:8080/
> > > mahout-taste-webapp-0.2-SNAPSHOT/RecommenderServlet?userID=1&debug=true
> > >
> > > And get NoSuchElementException regarding not finding the Group Lens
> data
> > > files in GroupLensDataModel.
> > >
> > > What am I doing wrong?
> > >
> > > If it can find the GroupLensRecommender class file, why can't it find
> the
> > > data files if they have the same path???
> > >
> > > java.util.NoSuchElementException
> > >
> >
>  org.apache.mahout.cf.taste.example.grouplens.GroupLensDataModel.buildItem(GroupLensDataModel.java:61)
> > >
> >
>  org.apache.mahout.cf.taste.impl.model.file.FileDataModel.processLine(FileDataModel.java:244)
> > >
> >
>  org.apache.mahout.cf.taste.impl.model.file.FileDataModel.processFile(FileDataModel.java:171)
> > >
> >
>  org.apache.mahout.cf.taste.impl.model.file.FileDataModel.reload(FileDataModel.java:127)
> > >
> >
>  org.apache.mahout.cf.taste.example.grouplens.GroupLensDataModel.reload(GroupLensDataModel.java:80)
> > >
> >
>  org.apache.mahout.cf.taste.impl.model.file.FileDataModel.checkLoaded(FileDataModel.java:259)
> > >
> >
>  org.apache.mahout.cf.taste.impl.model.file.FileDataModel.getUsers(FileDataModel.java:265)
> > >
> >
>

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