public class OutputTopNMetric extends AbstractMetric<OutputTopNMetric.Context,Void,Void>
Modifier and Type | Class and Description |
---|---|
static class |
OutputTopNMetric.Context |
static class |
OutputTopNMetric.Factory |
static class |
OutputTopNMetric.FactoryBuilder
Configure the prediction output.
|
Constructor and Description |
---|
OutputTopNMetric(org.grouplens.lenskit.eval.traintest.ExperimentOutputLayout layout,
File file,
int listSize,
ItemSelector candidates,
ItemSelector exclude) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the metric.
|
OutputTopNMetric.Context |
createContext(Attributed algo,
TTDataSet ds,
Recommender rec)
Create the context for an experimental condition (algorithm/data set pair).
|
Void |
doMeasureUser(TestUser user,
OutputTopNMetric.Context context)
Measure a user with typed results.
|
protected Void |
getTypedResults(OutputTopNMetric.Context context)
Get the typed results from an accumulator.
|
getColumnLabels, getPrefix, getResults, getSuffix, getUserColumnLabels, measureUser
public OutputTopNMetric(org.grouplens.lenskit.eval.traintest.ExperimentOutputLayout layout, File file, int listSize, ItemSelector candidates, ItemSelector exclude) throws IOException
IOException
public OutputTopNMetric.Context createContext(Attributed algo, TTDataSet ds, Recommender rec)
Metric
algo
- The algorithm.ds
- The data set.rec
- The LensKit recommender, if applicable. This can be null for an external
algorithm that does not provide a LensKit recommender.Metric.measureUser(TestUser, Object)
. If
the metric does not accumulate any results, this method can return null
.public Void doMeasureUser(TestUser user, OutputTopNMetric.Context context)
AbstractMetric
doMeasureUser
in class AbstractMetric<OutputTopNMetric.Context,Void,Void>
user
- The user to measure.context
- The context.null
to emit NAs for the user.protected Void getTypedResults(OutputTopNMetric.Context context)
AbstractMetric
getTypedResults
in class AbstractMetric<OutputTopNMetric.Context,Void,Void>
context
- The context.null
to emit NAs.public void close() throws IOException
AbstractMetric
close
in interface Closeable
close
in interface AutoCloseable
close
in class AbstractMetric<OutputTopNMetric.Context,Void,Void>
IOException
- if there is an error closing the metric.