Everything should be made as simple as possible, but not simpler. (Albert Einstein)

Saturday, September 24, 2016

Recommender Demo, "lenskit-hello" via Intellij Idea, Step by Step

For advanced programmer, it's easy. But a beginner might get a headache ;) 
Here is step by step: 

Prerequisites: Gradle, Intellij Idea. (and JDK for sure).


Clone or download demo of LensKit from here, https://github.com/lenskit/lenskit-hello

We can play first with the movie recommendation data in CSV files in the "data" folder.
  • Run Intellij Idea. 
  • Choose "Import Project". 
  • Navigate to the folder of "lenskit-hello". Click OK. 
  • On the dialog, select "Import project from external model".
    Then select "Gradle", next..
  • Select "Use local gradel distribution" if you want to use existing local gradle, otherwise (e.g. you want to update it) unselect.
     
  • For local, set Gradle home to your gradle installation (GRADLE_HOME), for example "D:/gradle-3.1".
Click Finish.
Gradle will download all dependencies (in case for the first time), i.e. the lenskit, fastutil, etc. 

Now Build the project.
Finally, Run..


As example, set Run configuration as follow: ("Application").
  •    Main class = org.grouplens.lenskit.hello.HelloLenskit
  •    Use classpath of module: lenskit-hello-master_main
  •    Try "program arguments" = 72 for userid=72, we want to get recommendation for user 72.

Apply, Run..

Here is the output, 

INFO  o.l.d.d.f.TextEntitySource - loading text file source ratings to read from file:/D:/LensKit/lenskit-hello-master/data/ratings.csv
INFO  o.l.d.d.f.TextEntitySource - loading text file source items to read from file:/D:/LensKit/lenskit-hello-master/data/movies.csv
INFO  o.l.d.d.f.TextEntitySource - loading text file source tags to read from file:/D:/LensKit/lenskit-hello-master/data/tags.csv
INFO  o.l.d.d.f.StaticDataSource - deriving entity type EntityType[user] from EntityType[rating] (column TypedName[user: long])
INFO  o.l.d.d.f.StaticDataSource - deriving entity type EntityType[item] from EntityType[rating] (column TypedName[item: long])
INFO  o.l.c.ConfigurationLoader - loading script from file:/D:/LensKit/lenskit-hello-master/etc/item-item.groovy
INFO  o.l.d.r.RatingSummaryProvider - summarized 8915 items with 100234 ratings
INFO  o.l.k.i.m.ItemItemBuildContextProvider - constructing build context
INFO  o.l.k.i.m.ItemItemModelProvider - building item-item model for 8915 items
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 100 of 8915 (0.01%, 0.005s/row, ETA 47.162s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 200 of 8915 (0.02%, 0.004s/row, ETA 38.043s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 300 of 8915 (0.03%, 0.004s/row, ETA 35.507s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 400 of 8915 (0.04%, 0.004s/row, ETA 34.930s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 500 of 8915 (0.06%, 0.004s/row, ETA 35.098s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 600 of 8915 (0.07%, 0.004s/row, ETA 33.451s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 700 of 8915 (0.08%, 0.004s/row, ETA 31.619s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 800 of 8915 (0.09%, 0.004s/row, ETA 32.728s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 900 of 8915 (0.10%, 0.004s/row, ETA 31.372s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 1000 of 8915 (0.11%, 0.004s/row, ETA 30.438s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 1100 of 8915 (0.12%, 0.004s/row, ETA 30.989s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 1200 of 8915 (0.13%, 0.004s/row, ETA 30.025s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 1300 of 8915 (0.15%, 0.004s/row, ETA 28.695s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 1400 of 8915 (0.16%, 0.004s/row, ETA 27.806s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 1500 of 8915 (0.17%, 0.004s/row, ETA 26.741s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 1600 of 8915 (0.18%, 0.004s/row, ETA 26.098s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 1700 of 8915 (0.19%, 0.004s/row, ETA 25.516s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 1800 of 8915 (0.20%, 0.004s/row, ETA 24.910s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 1900 of 8915 (0.21%, 0.003s/row, ETA 24.237s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 2000 of 8915 (0.22%, 0.003s/row, ETA 23.672s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 2100 of 8915 (0.24%, 0.003s/row, ETA 23.010s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 2200 of 8915 (0.25%, 0.003s/row, ETA 22.832s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 2300 of 8915 (0.26%, 0.003s/row, ETA 22.237s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 2400 of 8915 (0.27%, 0.003s/row, ETA 21.647s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 2500 of 8915 (0.28%, 0.003s/row, ETA 21.054s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 2600 of 8915 (0.29%, 0.003s/row, ETA 20.486s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 2700 of 8915 (0.30%, 0.003s/row, ETA 19.916s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 2800 of 8915 (0.31%, 0.003s/row, ETA 19.285s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 2900 of 8915 (0.33%, 0.003s/row, ETA 18.703s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 3000 of 8915 (0.34%, 0.003s/row, ETA 18.142s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 3100 of 8915 (0.35%, 0.003s/row, ETA 17.530s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 3200 of 8915 (0.36%, 0.003s/row, ETA 16.954s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 3300 of 8915 (0.37%, 0.003s/row, ETA 16.503s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 3400 of 8915 (0.38%, 0.003s/row, ETA 15.940s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 3500 of 8915 (0.39%, 0.003s/row, ETA 15.441s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 3600 of 8915 (0.40%, 0.003s/row, ETA 14.872s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 3700 of 8915 (0.42%, 0.003s/row, ETA 14.330s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 3800 of 8915 (0.43%, 0.003s/row, ETA 13.839s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 3900 of 8915 (0.44%, 0.003s/row, ETA 13.405s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 4000 of 8915 (0.45%, 0.003s/row, ETA 13.045s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 4100 of 8915 (0.46%, 0.003s/row, ETA 12.600s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 4200 of 8915 (0.47%, 0.003s/row, ETA 12.194s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 4300 of 8915 (0.48%, 0.003s/row, ETA 11.766s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 4400 of 8915 (0.49%, 0.003s/row, ETA 11.333s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 4500 of 8915 (0.50%, 0.002s/row, ETA 10.937s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 4600 of 8915 (0.52%, 0.002s/row, ETA 10.538s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 4700 of 8915 (0.53%, 0.002s/row, ETA 10.164s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 4800 of 8915 (0.54%, 0.002s/row, ETA 9.819s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 4900 of 8915 (0.55%, 0.002s/row, ETA 9.449s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 5000 of 8915 (0.56%, 0.002s/row, ETA 9.092s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 5100 of 8915 (0.57%, 0.002s/row, ETA 8.532s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 5200 of 8915 (0.58%, 0.002s/row, ETA 8.146s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 5300 of 8915 (0.59%, 0.002s/row, ETA 7.703s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 5400 of 8915 (0.61%, 0.002s/row, ETA 7.265s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 5500 of 8915 (0.62%, 0.002s/row, ETA 6.779s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 5600 of 8915 (0.63%, 0.002s/row, ETA 6.390s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 5700 of 8915 (0.64%, 0.002s/row, ETA 6.055s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 5800 of 8915 (0.65%, 0.002s/row, ETA 5.687s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 5900 of 8915 (0.66%, 0.002s/row, ETA 5.360s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 6000 of 8915 (0.67%, 0.002s/row, ETA 5.014s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 6100 of 8915 (0.68%, 0.002s/row, ETA 4.564s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 6200 of 8915 (0.70%, 0.002s/row, ETA 4.247s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 6300 of 8915 (0.71%, 0.002s/row, ETA 3.991s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 6400 of 8915 (0.72%, 0.001s/row, ETA 3.711s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 6500 of 8915 (0.73%, 0.001s/row, ETA 3.473s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 6600 of 8915 (0.74%, 0.001s/row, ETA 3.211s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 6700 of 8915 (0.75%, 0.001s/row, ETA 2.953s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 6800 of 8915 (0.76%, 0.001s/row, ETA 2.711s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 6900 of 8915 (0.77%, 0.001s/row, ETA 2.488s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 7000 of 8915 (0.79%, 0.001s/row, ETA 2.266s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 7100 of 8915 (0.80%, 0.001s/row, ETA 2.066s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 7200 of 8915 (0.81%, 0.001s/row, ETA 1.825s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 7300 of 8915 (0.82%, 0.001s/row, ETA 1.648s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 7400 of 8915 (0.83%, 0.001s/row, ETA 1.478s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 7500 of 8915 (0.84%, 0.001s/row, ETA 1.320s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 7600 of 8915 (0.85%, 0.001s/row, ETA 1.171s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 7700 of 8915 (0.86%, 0.001s/row, ETA 1.032s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 7800 of 8915 (0.87%, 0.001s/row, ETA 0.910s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 7900 of 8915 (0.89%, 0.001s/row, ETA 0.792s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 8000 of 8915 (0.90%, 0.001s/row, ETA 0.682s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 8100 of 8915 (0.91%, 0.001s/row, ETA 0.585s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 8200 of 8915 (0.92%, 0.001s/row, ETA 0.494s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 8300 of 8915 (0.93%, 0.001s/row, ETA 0.400s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 8400 of 8915 (0.94%, 0.001s/row, ETA 0.322s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 8500 of 8915 (0.95%, 0.001s/row, ETA 0.247s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 8600 of 8915 (0.96%, 0.001s/row, ETA 0.182s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 8700 of 8915 (0.98%, 0.001s/row, ETA 0.120s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 8800 of 8915 (0.99%, 0.001s/row, ETA 0.062s)
INFO  o.l.k.i.m.ItemItemModelProvider - item-item model build: finished 8900 of 8915 (1.00%, 0.001s/row, ETA 0.008s)
INFO  o.l.k.i.m.ItemItemModelProvider - built model of 29236544 similarities for 8915 items in 12.968s
INFO  o.g.l.hello.HelloLenskit - built recommender engine
INFO  o.g.l.hello.HelloLenskit - obtained recommender from engine
 

Recommendations for user 72:
    1771 (Night Flier (1997)): 5.71
    2189 (I Married A Strange Person! (1997)): 5.71
    2920 (Children of Paradise (Les enfants du paradis) (1945)): 5.71
    6939 (Gloomy Sunday (Ein Lied von Liebe und Tod) (1999)): 5.71
    1412 (Some Mother's Son (1996)): 5.68
    90524 (Abduction (2011)): 5.66
    40412 (Dead Man's Shoes (2004)): 5.65
    49330 (London to Brighton (2006)): 5.65
    6530 (Tenant, The (Locataire, Le) (1976)): 5.65
    50651 (Kenny (2006)): 5.65

Process finished with exit code 0



Note: As per my recommendation, if you are unstable, please don't watch the recommended "Gloomy Sunday" movie, because the song is known to drive people to suicide (including the singers).
./