public class MAEPredictMetric extends PredictMetric<MAEPredictMetric.Context>
Evaluate a recommender’s prediction accuracy with MAE (Mean Absolute Error).
Modifier and Type | Class and Description |
---|---|
class |
MAEPredictMetric.Context |
Constructor and Description |
---|
MAEPredictMetric() |
Modifier and Type | Method and Description |
---|---|
MAEPredictMetric.Context |
createContext(AlgorithmInstance algorithm,
DataSet dataSet,
RecommenderEngine engine)
Create the context for an experimental condition (algorithm/data set pair).
|
MetricResult |
getAggregateMeasurements(MAEPredictMetric.Context context)
Get the aggregate results from an accumulator.
|
MetricResult |
measureUser(TestUser user,
ResultMap predictions,
MAEPredictMetric.Context context)
Measure a single result.
|
getAggregateColumnLabels, getColumnLabels, getRequiredRoots
@Nullable public MAEPredictMetric.Context createContext(AlgorithmInstance algorithm, DataSet dataSet, RecommenderEngine engine)
Metric
Create 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<MAEPredictMetric.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, MAEPredictMetric.Context context)
PredictMetric
Measure 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<MAEPredictMetric.Context>
user
- The user’s test data.predictions
- The predictions.@Nonnull public MetricResult getAggregateMeasurements(MAEPredictMetric.Context context)
Metric
Get the aggregate results from an accumulator. The default implementation returns MetricResult.empty()
.
getAggregateMeasurements
in class Metric<MAEPredictMetric.Context>
context
- The context for an experimental condition.