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 Regressors 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
ConstructorsConstructorDescriptionRegressionMetric(MetricTarget<Regressor> tgt, String name, ToDoubleBiFunction<MetricTarget<Regressor>, org.tribuo.regression.evaluation.RegressionMetric.Context> impl) Construct a newRegressionMetricfor 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 newRegressionMetricfor the supplied metric target, using the supplied function. -
Method Summary
Modifier and TypeMethodDescriptiondoublecompute(org.tribuo.regression.evaluation.RegressionMetric.Context context) Compute the result of this metric from the input context.org.tribuo.regression.evaluation.RegressionMetric.ContextcreateContext(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, waitMethods 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 newRegressionMetricfor 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 newRegressionMetricfor 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:EvaluationMetricCompute the result of this metric from the input context.- Specified by:
computein 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:EvaluationMetricThe target for this metric instance.- Specified by:
getTargetin interfaceEvaluationMetric<Regressor, org.tribuo.regression.evaluation.RegressionMetric.Context>- Returns:
- The metric target.
-
getName
Description copied from interface:EvaluationMetricThe name of this metric.- Specified by:
getNamein 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:EvaluationMetricCreates the context this metric uses to compute it's value.- Specified by:
createContextin interfaceEvaluationMetric<Regressor, org.tribuo.regression.evaluation.RegressionMetric.Context>- Parameters:
model- The model to use.predictions- The predictions to use.- Returns:
- The metric context.
-