public class MulticlassClassificationEvaluator extends Evaluator implements HasPredictionCol, HasLabelCol, HasWeightCol, HasProbabilityCol, DefaultParamsWritable
Constructor and Description |
---|
MulticlassClassificationEvaluator() |
MulticlassClassificationEvaluator(String uid) |
Modifier and Type | Method and Description |
---|---|
DoubleParam |
beta()
The beta value, which controls precision vs recall weighting,
used in
"weightedFMeasure" , "fMeasureByLabel" . |
MulticlassClassificationEvaluator |
copy(ParamMap extra)
Creates a copy of this instance with the same UID and some extra params.
|
DoubleParam |
eps()
param for eps.
|
double |
evaluate(Dataset<?> dataset)
Evaluates model output and returns a scalar metric.
|
double |
getBeta() |
double |
getEps() |
double |
getMetricLabel() |
String |
getMetricName() |
MulticlassMetrics |
getMetrics(Dataset<?> dataset)
Get a MulticlassMetrics, which can be used to get multiclass classification
metrics such as accuracy, weightedPrecision, etc.
|
boolean |
isLargerBetter()
Indicates whether the metric returned by
evaluate should be maximized (true, default)
or minimized (false). |
Param<String> |
labelCol()
Param for label column name.
|
static MulticlassClassificationEvaluator |
load(String path) |
DoubleParam |
metricLabel()
The class whose metric will be computed in
"truePositiveRateByLabel" ,
"falsePositiveRateByLabel" , "precisionByLabel" , "recallByLabel" ,
"fMeasureByLabel" . |
Param<String> |
metricName()
param for metric name in evaluation (supports
"f1" (default), "accuracy" ,
"weightedPrecision" , "weightedRecall" , "weightedTruePositiveRate" ,
"weightedFalsePositiveRate" , "weightedFMeasure" , "truePositiveRateByLabel" ,
"falsePositiveRateByLabel" , "precisionByLabel" , "recallByLabel" ,
"fMeasureByLabel" , "logLoss" , "hammingLoss" ) |
Param<String> |
predictionCol()
Param for prediction column name.
|
Param<String> |
probabilityCol()
Param for Column name for predicted class conditional probabilities.
|
static MLReader<T> |
read() |
MulticlassClassificationEvaluator |
setBeta(double value) |
MulticlassClassificationEvaluator |
setEps(double value) |
MulticlassClassificationEvaluator |
setLabelCol(String value) |
MulticlassClassificationEvaluator |
setMetricLabel(double value) |
MulticlassClassificationEvaluator |
setMetricName(String value) |
MulticlassClassificationEvaluator |
setPredictionCol(String value) |
MulticlassClassificationEvaluator |
setProbabilityCol(String value) |
MulticlassClassificationEvaluator |
setWeightCol(String value) |
String |
toString() |
String |
uid()
An immutable unique ID for the object and its derivatives.
|
Param<String> |
weightCol()
Param for weight column name.
|
getPredictionCol
getLabelCol
getWeightCol
getProbabilityCol
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 MulticlassClassificationEvaluator(String uid)
public MulticlassClassificationEvaluator()
public static MulticlassClassificationEvaluator load(String path)
public static MLReader<T> read()
public final Param<String> probabilityCol()
HasProbabilityCol
probabilityCol
in interface HasProbabilityCol
public final Param<String> weightCol()
HasWeightCol
weightCol
in interface HasWeightCol
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 Param<String> metricName()
"f1"
(default), "accuracy"
,
"weightedPrecision"
, "weightedRecall"
, "weightedTruePositiveRate"
,
"weightedFalsePositiveRate"
, "weightedFMeasure"
, "truePositiveRateByLabel"
,
"falsePositiveRateByLabel"
, "precisionByLabel"
, "recallByLabel"
,
"fMeasureByLabel"
, "logLoss"
, "hammingLoss"
)
public String getMetricName()
public MulticlassClassificationEvaluator setMetricName(String value)
public MulticlassClassificationEvaluator setPredictionCol(String value)
public MulticlassClassificationEvaluator setLabelCol(String value)
public MulticlassClassificationEvaluator setWeightCol(String value)
public MulticlassClassificationEvaluator setProbabilityCol(String value)
public final DoubleParam metricLabel()
"truePositiveRateByLabel"
,
"falsePositiveRateByLabel"
, "precisionByLabel"
, "recallByLabel"
,
"fMeasureByLabel"
.
Must be greater than or equal to 0. The default value is 0.
public double getMetricLabel()
public MulticlassClassificationEvaluator setMetricLabel(double value)
public final DoubleParam beta()
"weightedFMeasure"
, "fMeasureByLabel"
.
Must be greater than 0. The default value is 1.
public double getBeta()
public MulticlassClassificationEvaluator setBeta(double value)
public final DoubleParam eps()
public double getEps()
public MulticlassClassificationEvaluator setEps(double value)
public double evaluate(Dataset<?> dataset)
Evaluator
isLargerBetter
specifies whether larger values are better.
public MulticlassMetrics 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 MulticlassClassificationEvaluator copy(ParamMap extra)
Params
defaultCopy()
.public String toString()
toString
in interface Identifiable
toString
in class Object