Monday, April 18, 2011

Simple Java Wicket using Mahout

While continuing the study of mahout, it is inevitable to write code that uses the various algorithms stored with it. So I asked a colleague to help out and one option was to start with a java wicket found here: http://blog.jteam.nl/wp-content/uploads/2010/04/taste-getting-started.zip

Using it is quite straightforward. Download the zip file. Unzip it to some folder (say taste-getting-started in the mahout machine). Using Ubuntu’s Terminal application, go to that folder and run mvn package. After packaging is complete, run mvn jetty:run-war. Once the jetty server is up, you can make use of the wicket by browsing http://localhost:8080/taste-getting-started/movies.

Although the above is the straightforward usage of the said wicket, setting it up requires some effort such as

  • downloading the MovieLens’ 100K Ratings Data Set: http://grouplens.org/system/files/ml-data_0.zip
  • Unzipping it to some other folder.
  • Copying u.data to taste-getting-started/src/main/resources/grouplens/100K/ratings
  • Copying u.item to taste-getting-started/src/main/resources/grouplens/100K/data
  • Executing the initialize_movielens_db.sql using the following command mysql --user=mysqluser --password=mysqlpassword < initialize_movielens_db.sql while at the taste-getting-started/src/main/resources/sql folder.

Oh and if you do not have MySQL yet, install it by issuing the following command sudo apt-get install mysql-server mysql-client.

2 comments:

  1. Hi Shem:
    I have gone through all the steps that you have mentioned and I have also installed the Eclipse IDE. But I don't know how to run the examples. Could you please help me with it?

    Do I have to install the Jetty? Because when I browse the test source files through Eclipse, it cannot find jetty references!
    For example org.mortbay..jetty.Connector can not be found, although another code which runs a simple Jetty web server runs and has no problems (a jetty kick start code).

    Do I have to make any changes to pom.xml?
    And I have no idea how to use that xml find mentioned in http://blog.jteam.nl/2010/04/15/mahout-taste-part-two-getting-started/.
    I'm talking about the following xml:



























    I would really appreciate your help :)
    Thank you,
    Aidin.

    ReplyDelete
  2. Thanks Aidin for your comment. Apologies too for this late reply as I've been busy at work this past few weeks.

    I might have failed to actually mention here how I ran the example. Here's how:

    at the prompt, I went to the /taste-getting/started/ folder and keyed in mvn package.

    After packaging, I keyed in mvn jetty:run-war.

    Maven will try to download all needed components.

    You might also want to check out how I setup my machine:

    http://teachitshem.blogspot.com/2011/03/journey-to-mahout-land.html

    ReplyDelete