weka.classifiers.evaluation
Class NumericPrediction

java.lang.Object
  extended byweka.classifiers.evaluation.NumericPrediction
All Implemented Interfaces:
Prediction, java.io.Serializable

public class NumericPrediction
extends java.lang.Object
implements Prediction, java.io.Serializable

Encapsulates an evaluatable numeric prediction: the predicted class value plus the actual class value.

Version:
$Revision: 1.6 $
Author:
Len Trigg (len@reeltwo.com)
See Also:
Serialized Form

Field Summary
private  double m_Actual
          The actual class value
private  double m_Predicted
          The predicted class value
private  double m_Weight
          The weight assigned to this prediction
 
Fields inherited from interface weka.classifiers.evaluation.Prediction
MISSING_VALUE
 
Constructor Summary
NumericPrediction(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.
 
Method Summary
 double actual()
          Gets the actual class value.
 double error()
          Calculates the prediction error.
 double predicted()
          Gets the predicted class value.
 java.lang.String toString()
          Gets a human readable representation of this prediction.
 double weight()
          Gets the weight assigned to this prediction.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_Actual

private double m_Actual
The actual class value


m_Predicted

private double m_Predicted
The predicted class value


m_Weight

private double m_Weight
The weight assigned to this prediction

Constructor Detail

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.
Method Detail

actual

public double actual()
Gets the actual class value.

Specified by:
actual in interface Prediction
Returns:
the actual class value, or MISSING_VALUE if no prediction was made.

predicted

public double predicted()
Gets the predicted class value.

Specified by:
predicted in interface Prediction
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:
weight in interface Prediction
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.

toString

public java.lang.String toString()
Gets a human readable representation of this prediction.

Returns:
a human readable representation of this prediction.