public abstract class ListOnlyTopNMetric<X> extends TopNMetric<X>
Intermediate class for top-N metrics that only depend on the list of recommended items, not their details. Metrics extending this class will implement the measureUser(TestUser, int, LongList, Object)
method instead of measureUser(TestUser, int, ResultList, Object)
. The recommend eval task uses this subclass to improve efficiency when results are not used in the evaluation.
Modifier | Constructor and Description |
---|---|
protected |
ListOnlyTopNMetric(Class<? extends TypedMetricResult> resType,
Class<? extends TypedMetricResult> aggType) |
protected |
ListOnlyTopNMetric(Class<? extends TypedMetricResult> resType,
Class<? extends TypedMetricResult> aggType,
String suffix) |
protected |
ListOnlyTopNMetric(List<String> labels,
List<String> aggLabels) |
Modifier and Type | Method and Description |
---|---|
abstract MetricResult |
measureUser(TestUser user,
int targetLength,
LongList recommendations,
X context)
Measurement method that only uses the recommend list.
|
MetricResult |
measureUser(TestUser user,
int targetLength,
ResultList recommendations,
X context)
Measure a single result.
|
createContext, getAggregateColumnLabels, getAggregateMeasurements, getColumnLabels, getRequiredRoots
protected ListOnlyTopNMetric(Class<? extends TypedMetricResult> resType, Class<? extends TypedMetricResult> aggType)
protected ListOnlyTopNMetric(Class<? extends TypedMetricResult> resType, Class<? extends TypedMetricResult> aggType, String suffix)
@Nonnull public final MetricResult measureUser(TestUser user, int targetLength, ResultList recommendations, X context)
TopNMetric
Measure a single result. The result may come from either prediction or recommendation.
measureUser
in class TopNMetric<X>
user
- The user’s test data.targetLength
- The intended length of the recommendation list.recommendations
- The user’s recommendations.@Nonnull public abstract MetricResult measureUser(TestUser user, int targetLength, LongList recommendations, X context)
Measurement method that only uses the recommend list.
user
- The user.targetLength
- The target list length.recommendations
- The list of recommendations.context
- The context.