public class RankingEvaluator extends Evaluator implements HasPredictionCol, HasLabelCol, DefaultParamsWritable
Constructor and Description |
---|
RankingEvaluator() |
RankingEvaluator(String uid) |
Modifier and Type | Method and Description |
---|---|
RankingEvaluator |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
double |
evaluate(Dataset<?> dataset)
Evaluates model output and returns a scalar metric.
|
int |
getK() |
String |
getMetricName() |
RankingMetrics<Object> |
getMetrics(Dataset<?> dataset)
Get a RankingMetrics, which can be used to get ranking metrics
such as meanAveragePrecision, meanAveragePrecisionAtK, etc.
|
boolean |
isLargerBetter()
Indicates whether the metric returned by
evaluate should be maximized (true, default)
or minimized (false). |
IntParam |
k()
param for ranking position value used in
"meanAveragePrecisionAtK" , "precisionAtK" ,
"ndcgAtK" , "recallAtK" . |
Param<String> |
labelCol()
Param for label column name.
|
static RankingEvaluator |
load(String path) |
Param<String> |
metricName()
param for metric name in evaluation (supports
"meanAveragePrecision" (default),
"meanAveragePrecisionAtK" , "precisionAtK" , "ndcgAtK" , "recallAtK" ) |
Param<String> |
predictionCol()
Param for prediction column name.
|
static MLReader<T> |
read() |
RankingEvaluator |
setK(int value) |
RankingEvaluator |
setLabelCol(String value) |
RankingEvaluator |
setMetricName(String value) |
RankingEvaluator |
setPredictionCol(String value) |
String |
toString() |
String |
uid()
An immutable unique ID for the object and its derivatives.
|
getPredictionCol
getLabelCol
clear, copyValues, defaultCopy, defaultParamMap, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, onParamChange, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
write
save
public RankingEvaluator(String uid)
public RankingEvaluator()
public static RankingEvaluator load(String path)
public static MLReader<T> read()
public final Param<String> labelCol()
HasLabelCol
labelCol
in interface HasLabelCol
public final Param<String> predictionCol()
HasPredictionCol
predictionCol
in interface HasPredictionCol
public String uid()
Identifiable
uid
in interface Identifiable
public final Param<String> metricName()
"meanAveragePrecision"
(default),
"meanAveragePrecisionAtK"
, "precisionAtK"
, "ndcgAtK"
, "recallAtK"
)public String getMetricName()
public RankingEvaluator setMetricName(String value)
public final IntParam k()
"meanAveragePrecisionAtK"
, "precisionAtK"
,
"ndcgAtK"
, "recallAtK"
. Must be > 0. The default value is 10.public int getK()
public RankingEvaluator setK(int value)
public RankingEvaluator setPredictionCol(String value)
public RankingEvaluator setLabelCol(String value)
public double evaluate(Dataset<?> dataset)
Evaluator
isLargerBetter
specifies whether larger values are better.
public RankingMetrics<Object> getMetrics(Dataset<?> dataset)
dataset
- a dataset that contains labels/observations and predictions.public boolean isLargerBetter()
Evaluator
evaluate
should be maximized (true, default)
or minimized (false).
A given evaluator may support multiple metrics which may be maximized or minimized.isLargerBetter
in class Evaluator
public RankingEvaluator copy(ParamMap extra)
Params
defaultCopy()
.public String toString()
toString
in interface Identifiable
toString
in class Object