public final class RegressionEvaluator extends Evaluator implements HasPredictionCol, HasLabelCol, HasWeightCol, DefaultParamsWritable
Constructor and Description |
---|
RegressionEvaluator() |
RegressionEvaluator(String uid) |
Modifier and Type | Method and Description |
---|---|
RegressionEvaluator |
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.
|
String |
getMetricName() |
RegressionMetrics |
getMetrics(Dataset<?> dataset)
Get a RegressionMetrics, which can be used to get regression
metrics such as rootMeanSquaredError, meanSquaredError, etc.
|
boolean |
getThroughOrigin() |
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 RegressionEvaluator |
load(String path) |
Param<String> |
metricName()
Param for metric name in evaluation.
|
Param<String> |
predictionCol()
Param for prediction column name.
|
static MLReader<T> |
read() |
RegressionEvaluator |
setLabelCol(String value) |
RegressionEvaluator |
setMetricName(String value) |
RegressionEvaluator |
setPredictionCol(String value) |
RegressionEvaluator |
setThroughOrigin(boolean value) |
RegressionEvaluator |
setWeightCol(String value) |
BooleanParam |
throughOrigin()
param for whether the regression is through the origin.
|
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
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 RegressionEvaluator(String uid)
public RegressionEvaluator()
public static RegressionEvaluator load(String path)
public static MLReader<T> read()
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()
"rmse"
(default): root mean squared error
- "mse"
: mean squared error
- "r2"
: R^2^ metric
- "mae"
: mean absolute error
- "var"
: explained variance
public String getMetricName()
public RegressionEvaluator setMetricName(String value)
public BooleanParam throughOrigin()
public boolean getThroughOrigin()
public RegressionEvaluator setThroughOrigin(boolean value)
public RegressionEvaluator setPredictionCol(String value)
public RegressionEvaluator setLabelCol(String value)
public RegressionEvaluator setWeightCol(String value)
public double evaluate(Dataset<?> dataset)
Evaluator
isLargerBetter
specifies whether larger values are better.
public RegressionMetrics 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 RegressionEvaluator copy(ParamMap extra)
Params
defaultCopy()
.public String toString()
toString
in interface Identifiable
toString
in class Object