public class IndependentRecallTopNMetric extends AbstractMetric<IndependentRecallTopNMetric.Context,IndependentRecallTopNMetric.Result,IndependentRecallTopNMetric.Result>
Modifier and Type | Class and Description |
---|---|
static class |
IndependentRecallTopNMetric.Builder |
class |
IndependentRecallTopNMetric.Context |
static class |
IndependentRecallTopNMetric.Result |
Constructor and Description |
---|
IndependentRecallTopNMetric(String pre,
String sfx,
ItemSelector queryItems,
ItemSelector candidates,
int listSize,
ItemSelector exclude) |
Modifier and Type | Method and Description |
---|---|
IndependentRecallTopNMetric.Context |
createContext(Attributed algo,
TTDataSet ds,
Recommender rec)
Create the context for an experimental condition (algorithm/data set pair).
|
IndependentRecallTopNMetric.Result |
doMeasureUser(TestUser user,
IndependentRecallTopNMetric.Context context)
Measure a user with typed results.
|
protected String |
getPrefix()
A prefix to be applied to column names.
|
protected String |
getSuffix()
A suffix to be applied to column names.
|
protected IndependentRecallTopNMetric.Result |
getTypedResults(IndependentRecallTopNMetric.Context context)
Get the typed results from an accumulator.
|
close, getColumnLabels, getResults, getUserColumnLabels, measureUser
public IndependentRecallTopNMetric(String pre, String sfx, ItemSelector queryItems, ItemSelector candidates, int listSize, ItemSelector exclude)
pre
- the prefix label for this evaluation, or null
for no prefix.sfx
- the suffix label for this evaluation, or null
for no suffix.queryItems
- the "true positive" items that we compute the hit rate overcandidates
- items to add to the recommendation, should be a random selectionlistSize
- The size of the recommendation list to evaluateexclude
- Items which should not be included in the recommendations.
Should not include test set.protected String getPrefix()
AbstractMetric
null
, this prefix will be applied and
separated with a period.getPrefix
in class AbstractMetric<IndependentRecallTopNMetric.Context,IndependentRecallTopNMetric.Result,IndependentRecallTopNMetric.Result>
protected String getSuffix()
AbstractMetric
null
, this suffix will be applied and
separated with a period.getSuffix
in class AbstractMetric<IndependentRecallTopNMetric.Context,IndependentRecallTopNMetric.Result,IndependentRecallTopNMetric.Result>
public IndependentRecallTopNMetric.Context createContext(Attributed algo, TTDataSet ds, Recommender rec)
Metric
algo
- The algorithm.ds
- The data set.rec
- The LensKit recommender, if applicable. This can be null for an external
algorithm that does not provide a LensKit recommender.Metric.measureUser(TestUser, Object)
. If
the metric does not accumulate any results, this method can return null
.public IndependentRecallTopNMetric.Result doMeasureUser(TestUser user, IndependentRecallTopNMetric.Context context)
AbstractMetric
doMeasureUser
in class AbstractMetric<IndependentRecallTopNMetric.Context,IndependentRecallTopNMetric.Result,IndependentRecallTopNMetric.Result>
user
- The user to measure.context
- The context.null
to emit NAs for the user.protected IndependentRecallTopNMetric.Result getTypedResults(IndependentRecallTopNMetric.Context context)
AbstractMetric
getTypedResults
in class AbstractMetric<IndependentRecallTopNMetric.Context,IndependentRecallTopNMetric.Result,IndependentRecallTopNMetric.Result>
context
- The context.null
to emit NAs.