All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.evaluation.NominalPrediction

java.lang.Object
    |
    +----weka.classifiers.evaluation.NominalPrediction

public class NominalPrediction
extends java.lang.Object
implements Prediction, java.io.Serializable
Encapsulates an evaluatable nominal prediction: the predicted probability distribution plus the actual class value.

Version:
$Revision: 1.8 $
Author:
Len Trigg (len@intelligenesis.net)

Constructor Index

 o NominalPrediction(double, double[])
Creates the NominalPrediction object with a default weight of 1.0.
 o NominalPrediction(double, double[], double)
Creates the NominalPrediction object.

Method Index

 o actual()
Gets the actual class value.
 o distribution()
Gets the predicted probabilities
 o makeDistribution(double, int)
Convert a single prediction into a probability distribution with all zero probabilities except the predicted value which has probability 1.0.
 o makeUniformDistribution(int)
Creates a uniform probability distribution -- where each of the possible classes is assigned equal probability.
 o margin()
Calculates the prediction margin.
 o predicted()
Gets the predicted class value.
 o toString()
Gets a human readable representation of this prediction.
 o weight()
Gets the weight assigned to this prediction.

Constructor Detail

 o NominalPrediction
public NominalPrediction(double actual,
                         double distribution[])
          Creates the NominalPrediction object with a default weight of 1.0.
Parameters:
actual - the actual value, or MISSING_VALUE.
distribution - the predicted probability distribution. Use NominalPrediction.makeDistribution() if you only know the predicted value.
 o NominalPrediction
public NominalPrediction(double actual,
                         double distribution[],
                         double weight)
          Creates the NominalPrediction object.
Parameters:
actual - the actual value, or MISSING_VALUE.
distribution - the predicted probability distribution. Use NominalPrediction.makeDistribution() if you only know the predicted value.
weight - the weight assigned to the prediction.

Method Detail

 o distribution
public double[] distribution()
          Gets the predicted probabilities
 o actual
public double actual()
          Gets the actual class value.
Returns:
the actual class value, or MISSING_VALUE if no prediction was made.
 o predicted
public double predicted()
          Gets the predicted class value.
Returns:
the predicted class value, or MISSING_VALUE if no prediction was made.
 o 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.
Returns:
the weight assigned to this prediction.
 o margin
public double margin()
          Calculates the prediction margin. This is defined as the difference between the probability predicted for the actual class and the highest predicted probability of the other classes.
Returns:
the margin for this prediction, or MISSING_VALUE if either the actual or predicted value is missing.
 o makeDistribution
public static double[] makeDistribution(double predictedClass,
                                        int numClasses)
          Convert a single prediction into a probability distribution with all zero probabilities except the predicted value which has probability 1.0. If no prediction was made, all probabilities are zero.
Parameters:
predictedClass - the index of the predicted class, or MISSING_VALUE if no prediction was made.
numClasses - the number of possible classes for this nominal prediction.
Returns:
the probability distribution.
 o makeUniformDistribution
public static double[] makeUniformDistribution(int numClasses)
          Creates a uniform probability distribution -- where each of the possible classes is assigned equal probability.
Parameters:
numClasses - the number of possible classes for this nominal prediction.
Returns:
the probability distribution.
 o toString
public java.lang.String toString()
          Gets a human readable representation of this prediction.
Returns:
a human readable representation of this prediction.
Overrides:
toString in class java.lang.Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home