public class TopNEntropyMetric extends AbstractMetric<TopNEntropyMetric.Context,TopNEntropyMetric.Result,Void>
Modifier and Type | Class and Description |
---|---|
static class |
TopNEntropyMetric.Builder |
class |
TopNEntropyMetric.Context |
static class |
TopNEntropyMetric.Result |
Constructor and Description |
---|
TopNEntropyMetric(String pre,
String sfx,
int listSize,
ItemSelector candidates,
ItemSelector exclude) |
Modifier and Type | Method and Description |
---|---|
TopNEntropyMetric.Context |
createContext(Attributed algo,
TTDataSet ds,
Recommender rec)
Create the context for an experimental condition (algorithm/data set pair).
|
Void |
doMeasureUser(TestUser user,
TopNEntropyMetric.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 TopNEntropyMetric.Result |
getTypedResults(TopNEntropyMetric.Context context)
Get the typed results from an accumulator.
|
List<String> |
getUserColumnLabels()
Get labels for the per-user columns output by this evaluator.
|
close, getColumnLabels, getResults, measureUser
public TopNEntropyMetric(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<TopNEntropyMetric.Context,TopNEntropyMetric.Result,Void>
protected String getSuffix()
AbstractMetric
null
, this suffix will be applied and
separated with a period.getSuffix
in class AbstractMetric<TopNEntropyMetric.Context,TopNEntropyMetric.Result,Void>
public TopNEntropyMetric.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 List<String> getUserColumnLabels()
Metric
getUserColumnLabels
in interface Metric<TopNEntropyMetric.Context>
getUserColumnLabels
in class AbstractMetric<TopNEntropyMetric.Context,TopNEntropyMetric.Result,Void>
Metric.measureUser(TestUser, Object)
public Void doMeasureUser(TestUser user, TopNEntropyMetric.Context context)
AbstractMetric
doMeasureUser
in class AbstractMetric<TopNEntropyMetric.Context,TopNEntropyMetric.Result,Void>
user
- The user to measure.context
- The context.null
to emit NAs for the user.protected TopNEntropyMetric.Result getTypedResults(TopNEntropyMetric.Context context)
AbstractMetric
getTypedResults
in class AbstractMetric<TopNEntropyMetric.Context,TopNEntropyMetric.Result,Void>
context
- The context.null
to emit NAs.