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,
Recommender recommender)
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, Recommender recommender)
Metric
Create the context for an experimental condition (algorithm/data set pair). The default implementation returns null
.
createContext
in class Metric<CoveragePredictMetric.Context>
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 measureUser(TestUser user, ResultMap predictions, CoveragePredictMetric.Context context)
PredictMetric
Measure a single result. The result may come from either prediction or recommendation.
measureUser
in class PredictMetric<CoveragePredictMetric.Context>
user
- The user’s test data.predictions
- The predictions.@Nonnull public MetricResult getAggregateMeasurements(CoveragePredictMetric.Context context)
Metric
Get 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.