public class TopNLengthMetric extends AbstractMetric<MeanAccumulator,TopNLengthMetric.Result,TopNLengthMetric.Result>
Modifier and Type | Class and Description |
---|---|
static class |
TopNLengthMetric.Builder
Build a Top-N length metric to measure Top-N lists.
|
static class |
TopNLengthMetric.Result |
Constructor and Description |
---|
TopNLengthMetric(String pre,
String sfx,
int listSize,
ItemSelector candidates,
ItemSelector exclude) |
Modifier and Type | Method and Description |
---|---|
MeanAccumulator |
createContext(Attributed algo,
TTDataSet ds,
Recommender rec)
Create the context for an experimental condition (algorithm/data set pair).
|
TopNLengthMetric.Result |
doMeasureUser(TestUser user,
MeanAccumulator 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 TopNLengthMetric.Result |
getTypedResults(MeanAccumulator context)
Get the typed results from an accumulator.
|
close, getColumnLabels, getResults, getUserColumnLabels, measureUser
public TopNLengthMetric(String pre, String sfx, int listSize, ItemSelector candidates, ItemSelector exclude)
protected String getPrefix()
AbstractMetric
null
, this prefix will be applied and
separated with a period.getPrefix
in class AbstractMetric<MeanAccumulator,TopNLengthMetric.Result,TopNLengthMetric.Result>
protected String getSuffix()
AbstractMetric
null
, this suffix will be applied and
separated with a period.getSuffix
in class AbstractMetric<MeanAccumulator,TopNLengthMetric.Result,TopNLengthMetric.Result>
public MeanAccumulator 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 TopNLengthMetric.Result doMeasureUser(TestUser user, MeanAccumulator context)
AbstractMetric
doMeasureUser
in class AbstractMetric<MeanAccumulator,TopNLengthMetric.Result,TopNLengthMetric.Result>
user
- The user to measure.context
- The context.null
to emit NAs for the user.protected TopNLengthMetric.Result getTypedResults(MeanAccumulator context)
AbstractMetric
getTypedResults
in class AbstractMetric<MeanAccumulator,TopNLengthMetric.Result,TopNLengthMetric.Result>
context
- The context.null
to emit NAs.