Package org.tribuo.regression.evaluation
Class RegressionMetric
java.lang.Object
org.tribuo.regression.evaluation.RegressionMetric
- All Implemented Interfaces:
EvaluationMetric<Regressor,
org.tribuo.regression.evaluation.RegressionMetric.Context>
public class RegressionMetric
extends Object
implements EvaluationMetric<Regressor,org.tribuo.regression.evaluation.RegressionMetric.Context>
A
EvaluationMetric
for Regressor
s which calculates the metric based on a
the true values and the predicted values.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.tribuo.evaluation.metrics.EvaluationMetric
EvaluationMetric.Average
-
Constructor Summary
ConstructorDescriptionRegressionMetric
(MetricTarget<Regressor> tgt, String name, ToDoubleBiFunction<MetricTarget<Regressor>, org.tribuo.regression.evaluation.RegressionMetric.Context> impl) Construct a newRegressionMetric
for the supplied metric target, using the supplied function.RegressionMetric
(MetricTarget<Regressor> tgt, String name, ToDoubleBiFunction<MetricTarget<Regressor>, org.tribuo.regression.evaluation.RegressionMetric.Context> impl, boolean useExampleWeights) Construct a newRegressionMetric
for the supplied metric target, using the supplied function. -
Method Summary
Modifier and TypeMethodDescriptiondouble
compute
(org.tribuo.regression.evaluation.RegressionMetric.Context context) Compute the result of this metric from the input context.org.tribuo.regression.evaluation.RegressionMetric.Context
createContext
(Model<Regressor> model, List<Prediction<Regressor>> predictions) Creates the context this metric uses to compute it's value.getName()
The name of this metric.The target for this metric instance.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.tribuo.evaluation.metrics.EvaluationMetric
createContext, getID
-
Constructor Details
-
RegressionMetric
public RegressionMetric(MetricTarget<Regressor> tgt, String name, ToDoubleBiFunction<MetricTarget<Regressor>, org.tribuo.regression.evaluation.RegressionMetric.Context> impl) Construct a newRegressionMetric
for the supplied metric target, using the supplied function. This does not use example weights.- Parameters:
tgt
- The metric target.name
- The name of the metric.impl
- The implementing function.
-
RegressionMetric
public RegressionMetric(MetricTarget<Regressor> tgt, String name, ToDoubleBiFunction<MetricTarget<Regressor>, org.tribuo.regression.evaluation.RegressionMetric.Context> impl, boolean useExampleWeights) Construct a newRegressionMetric
for the supplied metric target, using the supplied function.- Parameters:
tgt
- The metric target.name
- The name of the metric.impl
- The implementing function.useExampleWeights
- If true then the example weights are used to scale the example importance.
-
-
Method Details
-
compute
public double compute(org.tribuo.regression.evaluation.RegressionMetric.Context context) Description copied from interface:EvaluationMetric
Compute the result of this metric from the input context.- Specified by:
compute
in interfaceEvaluationMetric<Regressor,
org.tribuo.regression.evaluation.RegressionMetric.Context> - Parameters:
context
- The context to use.- Returns:
- The value of the metric.
-
getTarget
Description copied from interface:EvaluationMetric
The target for this metric instance.- Specified by:
getTarget
in interfaceEvaluationMetric<Regressor,
org.tribuo.regression.evaluation.RegressionMetric.Context> - Returns:
- The metric target.
-
getName
Description copied from interface:EvaluationMetric
The name of this metric.- Specified by:
getName
in interfaceEvaluationMetric<Regressor,
org.tribuo.regression.evaluation.RegressionMetric.Context> - Returns:
- The name.
-
createContext
public org.tribuo.regression.evaluation.RegressionMetric.Context createContext(Model<Regressor> model, List<Prediction<Regressor>> predictions) Description copied from interface:EvaluationMetric
Creates the context this metric uses to compute it's value.- Specified by:
createContext
in interfaceEvaluationMetric<Regressor,
org.tribuo.regression.evaluation.RegressionMetric.Context> - Parameters:
model
- The model to use.predictions
- The predictions to use.- Returns:
- The metric context.
-