Friday, April 22, 2011

Using a Different mahout Algorithm from the taste-getting-started Example

We were successful in running the taste-getting-started example as seen here: http://teachitshem.blogspot.com/2011/04/simple-java-wicket-using-mahout.html. However, mahout offers other recommendation algorithms which are so interesting to study. For instance, the PearsonCorrelationSimilarity whose parameters are similar to that EuclideanDistanceSimilarity used in the original taste-getting-started example.

How then can do this?

First, we duplicate the taste-getting-started folder say to tgs and we achieve this by issuing cp taste-getting-started tgs –R in the command line.

Second, we change the node <artifactId>taste-getting-started</artifactId> to <artifactId>tgs</artifactId> from the pom.xml file.

Third, open the recommeder-context.xml file at src/main/webapp/WEB-INF folder and replace euclideanDistanceRecommeder with pearsonCorrelationSimilarityRecommender, euclideanDistanceSimilarity with pearsonDistanceSimilarity, and similarity.EuclideanDistanceSimilarity with similarity.PearsonCorrelationSimilarity.

Fourth, run mvn package against tgs.

Fifth, in order to compare results with the original taste-getting-started we have run both the original taste-getting-started and the new tgs web applications using different ports. Thus for taste-getting-started we can use the usual mvn jetty:run-war that uses port 8080 but for tgs we must use something like mvn –Djetty.port=9090 jetty:run-war which uses the URL http://localhost:9090/tgs/movies.

Simple eh?

No comments:

Post a Comment