public abstract class TopNMetric<X> extends Metric<X>
Base class for metrics that measure Top-N recommendations for users.
| Modifier | Constructor and Description |
|---|---|
protected |
TopNMetric(Class<? extends TypedMetricResult> resType,
Class<? extends TypedMetricResult> aggType)
Construct a new result metric.
|
protected |
TopNMetric(Class<? extends TypedMetricResult> resType,
Class<? extends TypedMetricResult> aggType,
String suffix)
Construct a new result metric.
|
protected |
TopNMetric(List<String> labels,
List<String> aggLabels)
Construct a new result metric.
|
| Modifier and Type | Method and Description |
|---|---|
abstract MetricResult |
measureUser(TestUser user,
int targetLength,
ResultList recommendations,
X context)
Measure a single result.
|
createContext, getAggregateColumnLabels, getAggregateMeasurements, getColumnLabels, getRequiredRootsprotected TopNMetric(List<String> labels, List<String> aggLabels)
Construct a new result metric.
labels - Column labels.aggLabels - Aggregate column labels.protected TopNMetric(Class<? extends TypedMetricResult> resType, Class<? extends TypedMetricResult> aggType)
Construct a new result metric.
resType - The result type for measuring results, or null for no measurement.aggType - The result type for aggregate measurements, or null for no measurement.protected TopNMetric(Class<? extends TypedMetricResult> resType, Class<? extends TypedMetricResult> aggType, String suffix)
Construct a new result metric.
resType - The result type for measuring results, or null for no measurement.aggType - The result type for aggregate measurements, or null for no measurement.suffix - Suffix to apply to names.@Nonnull public abstract MetricResult measureUser(TestUser user, int targetLength, ResultList recommendations, X context)
Measure a single result. The result may come from either prediction or recommendation.
user - The user’s test data.targetLength - The intended length of the recommendation list.recommendations - The user’s recommendations.