Constructor and Description |
---|
RecommendEvalTask()
Create a new recommend eval task.
|
Modifier and Type | Method and Description |
---|---|
void |
addMetric(TopNMetric<?> metric)
Add a prediction metric.
|
ConditionEvaluator |
createConditionEvaluator(AlgorithmInstance algorithm,
DataSet dataSet,
RecommenderEngine rec)
Set up a measurement of a single recommender.
|
void |
finish()
Finalize this eval task.
|
static RecommendEvalTask |
fromJSON(com.fasterxml.jackson.databind.JsonNode json,
java.net.URI base)
Parse a recommend task from JSON.
|
java.util.List<Metric<?>> |
getAllMetrics()
Get the list of all metrics.
|
ItemSelector |
getCandidateSelector()
Get the active candidate selector.
|
ItemSelector |
getExcludeSelector()
Get the active exclude selector.
|
java.util.List<java.lang.String> |
getGlobalColumns()
Get columns that will go in the aggregate output file.
|
java.nio.file.Path |
getItemOutputFile()
Get the output file for writing per-target-item results.
|
java.lang.String |
getLabelPrefix()
Get the prefix applied to column labels.
|
int |
getListSize()
Get the list size to use.
|
java.nio.file.Path |
getOutputFile()
Get the output file for writing recommendations.
|
java.util.Set<java.lang.Class<?>> |
getRequiredRoots()
Get the root types required by this evaluation.
|
boolean |
getSeparateItems()
Query whether this task will separate items.
|
java.util.List<TopNMetric<?>> |
getTopNMetrics()
Get the list of prediction metrics.
|
java.util.List<java.lang.String> |
getUserColumns()
Get columns that will go in the per-user output file.
|
void |
setCandidateSelector(ItemSelector sel)
Set the candidate selector.
|
void |
setExcludeSelector(ItemSelector sel)
Set the exclude selector.
|
void |
setItemOutputFile(java.nio.file.Path file)
Set the output file for per-target-item results.
|
void |
setLabelPrefix(java.lang.String prefix)
Set the prefix applied to column labels.
|
void |
setListSize(int n)
Set the list size to use.
|
void |
setOutputFile(java.nio.file.Path file)
Set the output file for recommendations.
|
void |
setSeparateItems(boolean sep)
Control whether this task will separate items.
|
void |
start(ExperimentOutputLayout outputLayout)
Do initial setup for this eval task.
|
public static RecommendEvalTask fromJSON(com.fasterxml.jackson.databind.JsonNode json, java.net.URI base) throws java.io.IOException
Parse a recommend task from JSON.
json
- The JSON data.base
- The base URI (for resolving relative paths).java.io.IOException
- If there is an I/O error.public java.nio.file.Path getOutputFile()
Get the output file for writing recommendations.
null
if no file is configured.public void setOutputFile(java.nio.file.Path file)
Set the output file for recommendations.
file
- The output file for writing predictions. Will get a CSV file.public java.nio.file.Path getItemOutputFile()
Get the output file for writing per-target-item results.
null
if no file is configured.public void setItemOutputFile(java.nio.file.Path file)
Set the output file for per-target-item results.
file
- The output file for writing predictions. Will get a CSV file.public java.lang.String getLabelPrefix()
Get the prefix applied to column labels.
public void setLabelPrefix(java.lang.String prefix)
Set the prefix applied to column labels. If provided, it will be prepended to column labels from this task, along with a “.”.
prefix
- The label prefix.public int getListSize()
Get the list size to use.
public void setListSize(int n)
Set the list size to use.
n
- The number of items to recommend per user.public boolean getSeparateItems()
Query whether this task will separate items.
true
if test items are evaluated separately.public void setSeparateItems(boolean sep)
Control whether this task will separate items.
sep
- true
to evaluate test items separately.public ItemSelector getCandidateSelector()
Get the active candidate selector.
public void setCandidateSelector(ItemSelector sel)
Set the candidate selector.
sel
- The candidate selector.public ItemSelector getExcludeSelector()
Get the active exclude selector.
public void setExcludeSelector(ItemSelector sel)
Set the exclude selector.
sel
- The exclude selector.public java.util.List<TopNMetric<?>> getTopNMetrics()
Get the list of prediction metrics.
public java.util.List<Metric<?>> getAllMetrics()
Get the list of all metrics.
public void addMetric(TopNMetric<?> metric)
Add a prediction metric.
metric
- The metric to add.public java.util.Set<java.lang.Class<?>> getRequiredRoots()
EvalTask
Get the root types required by this evaluation.
getRequiredRoots
in interface EvalTask
public java.util.List<java.lang.String> getGlobalColumns()
EvalTask
Get columns that will go in the aggregate output file.
getGlobalColumns
in interface EvalTask
public java.util.List<java.lang.String> getUserColumns()
EvalTask
Get columns that will go in the per-user output file.
getUserColumns
in interface EvalTask
public void start(ExperimentOutputLayout outputLayout)
EvalTask
Do initial setup for this eval task. This should create any per-task output files, etc.
public void finish()
EvalTask
Finalize this eval task. This should finish writing and close any per-task output files, etc.
public ConditionEvaluator createConditionEvaluator(AlgorithmInstance algorithm, DataSet dataSet, RecommenderEngine rec)
EvalTask
Set up a measurement of a single recommender.
createConditionEvaluator
in interface EvalTask
algorithm
- The algorithm being evaluated.dataSet
- The data set being evaluated.rec
- The recommender engine that will be measured.