Package weka.classifiers.evaluation
Class NumericPrediction
java.lang.Object
weka.classifiers.evaluation.NumericPrediction
- All Implemented Interfaces:
Serializable,Prediction,RevisionHandler
Encapsulates an evaluatable numeric prediction: the predicted class value
plus the actual class value.
- Version:
- $Revision: 8034 $
- Author:
- Len Trigg (len@reeltwo.com)
- See Also:
-
Field Summary
Fields inherited from interface weka.classifiers.evaluation.Prediction
MISSING_VALUE -
Constructor Summary
ConstructorsConstructorDescriptionNumericPrediction(double actual, double predicted) Creates the NumericPrediction object with a default weight of 1.0.NumericPrediction(double actual, double predicted, double weight) Creates the NumericPrediction object.NumericPrediction(double actual, double predicted, double weight, double[][] predInt) Creates the NumericPrediction object. -
Method Summary
Modifier and TypeMethodDescriptiondoubleactual()Gets the actual class value.doubleerror()Calculates the prediction error.Returns the revision string.doubleGets the predicted class value.double[][]Returns the predictions intervals.voidsetPredictionIntervals(double[][] predInt) Sets the prediction intervals for this prediction.toString()Gets a human readable representation of this prediction.doubleweight()Gets the weight assigned to this prediction.
-
Constructor Details
-
NumericPrediction
public NumericPrediction(double actual, double predicted) Creates the NumericPrediction object with a default weight of 1.0.- Parameters:
actual- the actual value, or MISSING_VALUE.predicted- the predicted value, or MISSING_VALUE.
-
NumericPrediction
public NumericPrediction(double actual, double predicted, double weight) Creates the NumericPrediction object.- Parameters:
actual- the actual value, or MISSING_VALUE.predicted- the predicted value, or MISSING_VALUE.weight- the weight assigned to the prediction.
-
NumericPrediction
public NumericPrediction(double actual, double predicted, double weight, double[][] predInt) Creates the NumericPrediction object.- Parameters:
actual- the actual value, or MISSING_VALUE.predicted- the predicted value, or MISSING_VALUE.weight- the weight assigned to the prediction.predInt- the prediction intervals from classifiers implementing theIntervalEstimatorinterface.- See Also:
-
-
Method Details
-
actual
public double actual()Gets the actual class value.- Specified by:
actualin interfacePrediction- Returns:
- the actual class value, or MISSING_VALUE if no prediction was made.
-
predicted
public double predicted()Gets the predicted class value.- Specified by:
predictedin interfacePrediction- Returns:
- the predicted class value, or MISSING_VALUE if no prediction was made.
-
weight
public double weight()Gets the weight assigned to this prediction. This is typically the weight of the test instance the prediction was made for.- Specified by:
weightin interfacePrediction- Returns:
- the weight assigned to this prediction.
-
error
public double error()Calculates the prediction error. This is defined as the predicted value minus the actual value.- Returns:
- the error for this prediction, or MISSING_VALUE if either the actual or predicted value is missing.
-
setPredictionIntervals
public void setPredictionIntervals(double[][] predInt) Sets the prediction intervals for this prediction.- Parameters:
predInt- the prediction intervals
-
predictionIntervals
public double[][] predictionIntervals()Returns the predictions intervals. Only classifiers implementing theIntervalEstimatorinterface.- Returns:
- the prediction intervals.
- See Also:
-
toString
Gets a human readable representation of this prediction. -
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Returns:
- the revision
-