public class CoveragePredictMetric extends PredictMetric<CoveragePredictMetric.Context>
Simple evaluator that records user, rating and prediction counts and computes recommender coverage over the queried items.
| Modifier and Type | Class and Description |
|---|---|
static class |
CoveragePredictMetric.AggregateCoverage |
class |
CoveragePredictMetric.Context |
static class |
CoveragePredictMetric.Coverage |
| Constructor and Description |
|---|
CoveragePredictMetric() |
| Modifier and Type | Method and Description |
|---|---|
CoveragePredictMetric.Context |
createContext(AlgorithmInstance algorithm,
DataSet dataSet,
RecommenderEngine engine)
Create the context for an experimental condition (algorithm/data set pair).
|
MetricResult |
getAggregateMeasurements(CoveragePredictMetric.Context context)
Get the aggregate results from an accumulator.
|
MetricResult |
measureUser(TestUser user,
ResultMap predictions,
CoveragePredictMetric.Context context)
Measure a single result.
|
getAggregateColumnLabels, getColumnLabels, getRequiredRoots@Nullable public CoveragePredictMetric.Context createContext(AlgorithmInstance algorithm, DataSet dataSet, RecommenderEngine engine)
MetricCreate the context for an experimental condition (algorithm/data set pair). The default implementation returns null.
Note: Contexts must be thread-safe, in that multiple concurrent calls to the appropriate user-measurement function with the same context must be safe. This can be handled either by the context itself, or by the user-measurement function.
createContext in class Metric<CoveragePredictMetric.Context>algorithm - The algorithm.dataSet - The data set.engine - The LensKit recommender engine, if applicable. This can be null for an external algorithm that does not provide a LensKit recommender.null.@Nonnull public MetricResult measureUser(TestUser user, ResultMap predictions, CoveragePredictMetric.Context context)
PredictMetricMeasure a single result. The result may come from either prediction or recommendation.
Thread Safety: This method may be called concurrently by multiple threads with the same recommender and context.
measureUser in class PredictMetric<CoveragePredictMetric.Context>user - The user’s test data.predictions - The predictions.@Nonnull public MetricResult getAggregateMeasurements(CoveragePredictMetric.Context context)
MetricGet the aggregate results from an accumulator. The default implementation returns MetricResult.empty().
getAggregateMeasurements in class Metric<CoveragePredictMetric.Context>context - The context for an experimental condition.