1

I have a "csv " file which contains the user id, the book he/she has read, the rating for each book. I want to use Lenskit to predict a book rating for a user. For example, the user A has read 3 books,A,B,C, I want to predicate the rating for the book A and see how close the predication is from the real rating. May anyone give me some idea about how to use Lenskit to do that. I am not developing any website and all of my code are just normal java files in Eclipse.

user3369592
  • 1,367
  • 5
  • 21
  • 43

1 Answers1

2

First, the traditional way to do this is via cross-validation, where you do a robust randomized splitting of the data into training data and test data.

The LensKit Evaluator supports doing this. The Quick Start descries how to get started; also there is a quick start that includes current best practices on running evaluations.

So you will need to set up an evaluation that does the following:

  1. partitions your data for evaluation
  2. runs it on the LensKit algorithm you want to use
Michael Ekstrand
  • 28,379
  • 9
  • 61
  • 93
  • thank you. So I just download the Lenskit and import it into my java project in Eclipse? Then I can use algorithms from the Lensk with my dateset? – user3369592 Mar 04 '15 at 09:50
  • 1
    @user3369592 Basically, yes. I'd recommend using Maven, Gradle, Ivy, or a similar tool to import LensKit from Maven Central instead of manually downloading and importing. The relevant Maven snippet is here: http://lenskit.org/download/ – Michael Ekstrand Mar 06 '15 at 15:04
  • When I am using Intellij to use this demo https://github.com/lenskit/lenskit-hello , intellij gave me error : EventDAO dao = new SimpleFileRatingDAO(inputFile, delimiter); SimpleFileRatingDAO is deprecated. – user3369592 Mar 09 '15 at 02:55
  • 1
    @user3369592 to be clear, that is a warning, not an error; the code will still work fine. But `SimpleFileRatingDAO` has been deprecated in favor of `TextEventDAO`; we just haven't updated the docs and examples yet. – Michael Ekstrand Mar 09 '15 at 23:55
  • @ Michael Ekstrand I used Intellij to import this project :github.com/lenskit/lenskit-hello . I also downloaded the ml-100l movie dataset. Then I modified the java file hello.java" inputFile = new File("ml-100k/u.data");" It outputed"INFO o.g.l.k.i.m.ItemItemBuildContextProvider - constructing build context INFO o.g.l.k.i.m.ItemItemModelBuilder - built model for 1682 items in 2.947 s" then the program just stopped – user3369592 Mar 10 '15 at 20:41
  • i output the users object and it is empty. May you give me some ideas about how I could get the recommendation items for users. – user3369592 Mar 10 '15 at 20:46
  • 1
    @user3369592 The lenskit-hello project takes user IDs on the command line, and outputs recommendations for those users. Try passing '100' as a command line argument. – Michael Ekstrand Mar 11 '15 at 00:47
  • @ Michael EkstrandThank you for your help. I used the ratingpredicator in my hello.java so I can see the predicated rating for an user on a book. But now, I want to calculate the overall predication errors for all users. I saw this link: grepcode.com/file/repo1.maven.org/maven2/org.grouplens.lenskit/… May you give me some idea how to use this class to calculate the overall predicate discrepancy among all users(use moive-100k dataset). – user3369592 Mar 11 '15 at 22:55
  • the link I put above is RMSEPredictMetri : http://grepcode.com/file/repo1.maven.org/maven2/org.grouplens.lenskit/lenskit-eval/1.0.2/org/grouplens/lenskit/eval/metrics/predict/RMSEPredictMetric.java. For example, I tried with 5 users and all of predication discrepancies are within 0.5(the predication - real rating) but is there any way we could see the overall predicate discrepancy among all users? – user3369592 Mar 11 '15 at 22:57
  • @user3369592 That is what the evaluator is for; you can run it on its own, as described in the QuickStart page linked. You can also run it from inside a Java program, using the `SimpleEvaluator` class. The metrics are only intended for use inside an evaluation. – Michael Ekstrand Mar 12 '15 at 20:14
  • Thank you! I put my new question here. http://stackoverflow.com/questions/29023592/book-rating-predication-using-lenskit?noredirect=1#comment46289911_29023592 – user3369592 Mar 13 '15 at 02:01
  • When I run the script, it gave me the error : No signature of method: eval.trainTest() is applicable for argument types: – user3369592 Mar 13 '15 at 02:40