Class PredictionArray

java.lang.Object
  |
  +--PredictionArray
All Implemented Interfaces:
java.io.Serializable

public class PredictionArray
extends java.lang.Object
implements java.io.Serializable

This class generates a prediction array of the provided set. The prediction array is generated according to Wilson's Classifier Fitness Based on Accuracy (Evolutionary Computation Journal, 1995). Moreover, this class provides all methods to handle selection in the prediction array, essentially, to select the best action, a present random action or an action by roulette wheel selection.

Since:
JDK 1.3
See Also:
Serialized Form

Field Summary
private  double[] nr
          The sum of the fitnesses of classifiers that represent each entry in the prediction array.
private  double[] pa
          The prediction array.
 
Constructor Summary
PredictionArray(XClassifierSet set, int size)
          Constructs the prediction array according to the current set and the possible number of actions.
 
Method Summary
 int bestActionWinner()
          Selects the action in the prediction array with the best value.
 double getBestValue()
          Returns the highest value in the prediction array.
 double getValue(int i)
          Returns the value of the specified entry in the prediction array.
 int randomActionWinner()
          Selects an action randomly.
 int rouletteActionWinner()
          Selects an action in the prediction array by roulette wheel selection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pa

private double[] pa
The prediction array.


nr

private double[] nr
The sum of the fitnesses of classifiers that represent each entry in the prediction array.

Constructor Detail

PredictionArray

public PredictionArray(XClassifierSet set,
                       int size)
Constructs the prediction array according to the current set and the possible number of actions.

Parameters:
set - The classifier set out of which a prediction array is formed (normally the match set).
size - The number of entries in the prediction array (should be set to the number of possible actions in the problem)
Method Detail

getBestValue

public double getBestValue()
Returns the highest value in the prediction array.


getValue

public double getValue(int i)
Returns the value of the specified entry in the prediction array.


randomActionWinner

public int randomActionWinner()
Selects an action randomly. The function assures that the chosen action is represented by at least one classifier.


bestActionWinner

public int bestActionWinner()
Selects the action in the prediction array with the best value.


rouletteActionWinner

public int rouletteActionWinner()
Selects an action in the prediction array by roulette wheel selection.