Saturday, November 10, 2012

Duine Open Source Recommender


Duine  is a open source Recommender System. It is a collection of software libraries developed by Telematica Instituut/Novay that intends to predict how interesting is an information to a user. It provides the collaborative filtering and content
based recommender and other features, such as an Explanation API (explanations to why such recommendations has been made).
Its result recommendations are quantified by a number, ranging from -1 to +1, being that the
greater the result, the more interesting the item should be to the user.
One of the main advantages of Duine is its well formed architecture. When it performs a
recommendation, it can incorporate the user feedback to its systems. Also, it possess a switching
engine, being able to analyse which method (content or collaborative) is better in the data situation, and
dynamically change it.

a . Architecture

The following picture describes the main concept of Duine framework.


b. Installation

To install the framework it is advised to follow some steps. It is first necessary to download the code http://sourceforge.net/projects/duine/files/. Then you should build and run the project with the Maven project manager. The file that you will be running is MovieLensRecommenderClient.java with the dataset of MovieLens, which is already incorporated in the Duine package.

c. Examples

To create a Duine recommender you should create and run a scenario involving users and items.
Here follows a simple example, with no previous dataset. First we create an item (a movie) and we set a characteristic (being the type “horror”) . Then we create a user and we try to calculate a recommendation to this user on the item. This prediction should not work, since we have no rating information on the user or the item. Afterwards, we explicitly give a feedback from the user to the genre of the item (we give “horror” a rating of 0.4) and try a prediction again. This time, we tested the ability of Duine correlate the genre with the item, and the rating result to the item shows exactly the  same number as the feedback giving by the user. Then finally give a rating from the user to the item. As
expected, when making the recommendation Duine presents the rating given as result.
The example code:

1. public void runScenarioTest() {
2.   double temp;
3.   log.info("********* SCENARIO TEST - RENATA **********");
4.   log.info("Create a new movie with genre 'horror'");
5.   RatableItemId item1 = new RatableItemId("1");
6.   Movie movie1 = new Movie(item1);
7.
8.   ArrayList<String> genres = new ArrayList<String>();
9.   genres.add("horror");
10.  movie1.setGenres(genres);
11.  movie1.setTitle("movie1");
12.
13.  log.info("Create a user id 'user1'");
14.  UserId user1 = new UserId("user1");
15.
16.  log.info("Calculate a prediction for the interest of this
user in this movie");
17.  Prediction prediction = recommender.predict(user1, movie1);
18.  log.info("Prediction result: " + prediction);
19.
20.

21.  log.info("Enter term feedback for user1: term='horror',value=0.4, certainty='0.8'");22. ITermFeedback termFeedback = new TermFeedback("horror",0.4, 0.8);23. recommender.enterFeedback(user1, termFeedback);24. log.info("Calculate a prediction for the interest of thisuser in this movie");                                                             
25.  Prediction prediction3 = recommender.predict(user1,movie1);         
26.  log.info("Prediction result: " + prediction3);
27.  log.info(prediction3.getExplanation());                                       
29.  log.info("Give a rating to the movie (value=0.9, certainty=0.8)");
30.  IRatableItemFeedback feedback = new RatableItemFeedback(movie1, 0.9, 0.8);
31.  recommender.enterFeedback(user1, feedback);
32.  log.info("Calculate a prediction for the interest of this user in this movie");
33.  Prediction prediction2 = recommender.predict(user1,movie1); 

34.  log.info("Prediction result: " + prediction2);
35. }

1 comment:

  1. hi, in which the method of evaluation is based Duine

    ReplyDelete