public abstract class ResultMetric<X> extends Metric<X>
Base class for metrics that measure individual recommendation or prediction results.
Modifier | Constructor and Description |
---|---|
protected |
ResultMetric(Class<? extends TypedMetricResult> resType,
Class<? extends TypedMetricResult> aggType)
Construct a new result metric.
|
protected |
ResultMetric(List<String> labels,
List<String> aggLabels)
Construct a new result metric.
|
Modifier and Type | Method and Description |
---|---|
abstract MetricResult |
measureResult(long userId,
Result result,
X context)
Measure a single result.
|
createContext, getAggregateColumnLabels, getAggregateMeasurements, getColumnLabels, getRequiredRoots
protected ResultMetric(List<String> labels, List<String> aggLabels)
Construct a new result metric.
labels
- Column labels.aggLabels
- Aggregate column labels.protected ResultMetric(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.@Nonnull public abstract MetricResult measureResult(long userId, Result result, X context)
Measure a single result. The result may come from either prediction or recommendation.
userId
- The user ID.result
- The result to measure.