public class TopNNDPMMetric extends ListOnlyTopNMetric<MeanAccumulator>
Measure the nDPM of the top-N recommendations, using rankings. This metric is registered with the type name ndpm
. The paper used as a reference for this implementation is http://www2.cs.uregina.ca/~yyao/PAPERS/jasis_ndpm.pdf.
Modifier and Type | Class and Description |
---|---|
static class |
TopNNDPMMetric.Spec
Specification for configuring nDPM metrics.
|
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_COLUMN |
Constructor and Description |
---|
TopNNDPMMetric(String name)
Construct a new nDPM Top-N metric.
|
TopNNDPMMetric(TopNNDPMMetric.Spec spec)
Construct a top-N nDCG metric from a spec.
|
Modifier and Type | Method and Description |
---|---|
MeanAccumulator |
createContext(AlgorithmInstance algorithm,
DataSet dataSet,
Recommender recommender)
Create the context for an experimental condition (algorithm/data set pair).
|
MetricResult |
getAggregateMeasurements(MeanAccumulator context)
Get the aggregate results from an accumulator.
|
MetricResult |
measureUser(TestUser user,
int targetLength,
LongList recommendations,
MeanAccumulator context)
Measurement method that only uses the recommend list.
|
measureUser
getAggregateColumnLabels, getColumnLabels, getRequiredRoots
public static final String DEFAULT_COLUMN
public TopNNDPMMetric(TopNNDPMMetric.Spec spec)
Construct a top-N nDCG metric from a spec.
spec
- The spec.public TopNNDPMMetric(String name)
Construct a new nDPM Top-N metric.
@Nullable public MeanAccumulator createContext(AlgorithmInstance algorithm, DataSet dataSet, Recommender recommender)
Metric
Create the context for an experimental condition (algorithm/data set pair). The default implementation returns null
.
createContext
in class Metric<MeanAccumulator>
algorithm
- The algorithm.dataSet
- The data set.recommender
- The LensKit recommender, if applicable. This can be null for an external algorithm that does not provide a LensKit recommender.null
.@Nonnull public MetricResult getAggregateMeasurements(MeanAccumulator context)
Metric
Get the aggregate results from an accumulator. The default implementation returns MetricResult.empty()
.
getAggregateMeasurements
in class Metric<MeanAccumulator>
context
- The context for an experimental condition.@Nonnull public MetricResult measureUser(TestUser user, int targetLength, LongList recommendations, MeanAccumulator context)
ListOnlyTopNMetric
Measurement method that only uses the recommend list.
measureUser
in class ListOnlyTopNMetric<MeanAccumulator>
user
- The user.targetLength
- The target list length.recommendations
- The list of recommendations.context
- The context.