I'm a student using Lenskit and I would like to implement the Intra-List similarity metric for my project. How can I implement the new TopN-metric from scratch? I'm not used to working with Gradle/Java, Implementing my own re-ranking algorithm was nice to do but I don't know how to start implementing a metric and then adding it by defining a type-name?.. I'm a little lost.
Thanks, Diederik
There are two pieces:'
Implement your new metric by extendingTopNMetric
(or ListOnlyTopNMetric
). The X
type parameter is the type of context object that is used to keep track of a particular evaluation experiment (algorithm + data set combo). You will probably need to extract whatever data you're using to compute ILS from the recommender in createContext
and save it in your context object. The context class is usually a static inner class of the metric class.
Create a properties file, META-INF/lenskit/topn-metrics.properties
, that will show in your classpath (put it under src/main/resources
in a standard Maven or Gradle project layout) to associate a name with your metric's class. There you write
ils=my.package.ILSTOpNMetric
This can all live in the same general project as your algorithm code.