geneticWedge.gp.postProcess
Class PostProcessor

java.lang.Object
  extended by geneticWedge.gp.postProcess.PostProcessor

public class PostProcessor
extends java.lang.Object

PostProcessor allows access to various properties after an evolutionary run. Available properties include:


Nested Class Summary
static class PostProcessor.SELECT_MODE
          SELECT_MODE sets the method by which the 'best' individual is selected.
 
Constructor Summary
PostProcessor()
           
 
Method Summary
static double[] getAllClassificationData(double[][] data, double threshold)
          getAllClassificationData returns the numbers of true positives, false positives, true negatives and false negatives, given a data array and a threshold (cut-off).
static double[] getAllFitnesses(java.lang.String filename, boolean getLowest)
          getAllFitnesses returns the training, validation and test fitnesses for the 'best' individual, selected on validation fitness.
static double[] getAllFitnesses(java.lang.String filename, boolean getLowest, PostProcessor.SELECT_MODE mode)
          getAllFitnesses returns the training, validation and test fitnesses for the 'best' individual, selected using the criterion mode.
static double[] getAllRSquared(java.lang.String filename, PostProcessor.SELECT_MODE mode)
          getAllRSquared returns an array containing R-squared values (Pearson coefficients) for training, validation and test data.
static java.lang.String getBestIndividualAsString(java.lang.String filename, boolean getLowest, PostProcessor.SELECT_MODE mode)
          getBestIndividualAsString returns the 'best' individual as a string, containing all nodes as a comma-separated list.
static double[] getBestValidationAndTestFitness(java.lang.String filename, boolean getLowest)
          getBestValidationAndTestFitness returns the validation and test fitnesses for the 'best' individual, selected on validation fitness.
static double[] setThreshold(int targetNumber, boolean targetIsPositive, double[][] data)
           
static double[] setThresholdForPPV(double targetPPV, double[][] data)
          setThresholdForPPV attamepts to set a threshold (cut-off) value that will yield the desired PPV (positive predictive value).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PostProcessor

public PostProcessor()
Method Detail

getAllRSquared

public static double[] getAllRSquared(java.lang.String filename,
                                      PostProcessor.SELECT_MODE mode)
                               throws java.io.IOException
getAllRSquared returns an array containing R-squared values (Pearson coefficients) for training, validation and test data.

Throws:
java.io.IOException

getAllFitnesses

public static double[] getAllFitnesses(java.lang.String filename,
                                       boolean getLowest)
                                throws java.io.IOException
getAllFitnesses returns the training, validation and test fitnesses for the 'best' individual, selected on validation fitness.

Parameters:
getLowest - if true, returns the individual with the lowest validation fitness, otherwise the individual with the highest validation fitness.
Throws:
java.io.IOException

getAllFitnesses

public static double[] getAllFitnesses(java.lang.String filename,
                                       boolean getLowest,
                                       PostProcessor.SELECT_MODE mode)
                                throws java.io.IOException
getAllFitnesses returns the training, validation and test fitnesses for the 'best' individual, selected using the criterion mode.

Parameters:
getLowest - if true, returns the individual with the lowest fitness, otherwise the individual with the highest fitness.
Throws:
java.io.IOException

getBestIndividualAsString

public static java.lang.String getBestIndividualAsString(java.lang.String filename,
                                                         boolean getLowest,
                                                         PostProcessor.SELECT_MODE mode)
                                                  throws java.io.IOException
getBestIndividualAsString returns the 'best' individual as a string, containing all nodes as a comma-separated list.

Parameters:
getLowest - if true, a string representation of the individual with the lowest fitness is returend, otherwise a string representation of the individual with the highest fitness.
mode - The criterion used to select the 'best' individual
Throws:
java.io.IOException

getBestValidationAndTestFitness

public static double[] getBestValidationAndTestFitness(java.lang.String filename,
                                                       boolean getLowest)
                                                throws java.io.IOException
getBestValidationAndTestFitness returns the validation and test fitnesses for the 'best' individual, selected on validation fitness.

Parameters:
getLowest - if true, returns the individual with the lowest validation fitness, otherwise the individual with the highest validation fitness.
Throws:
java.io.IOException

setThreshold

public static double[] setThreshold(int targetNumber,
                                    boolean targetIsPositive,
                                    double[][] data)
Parameters:
targetNumber - The number of predictions that will have the desired output (positive or negative) once the threshold has been set.
targetIsPositive - Whether targetNumber refers to the number of positive outputs (true) or negative outputs (false).
data - An array containing the raw outputs and the target (binary) outputs.
Returns:
An array containing 5 elements: the best threshold and the following 4 values given this threshold: TP, FP, TN, FN.

setThresholdForPPV

public static double[] setThresholdForPPV(double targetPPV,
                                          double[][] data)
setThresholdForPPV attamepts to set a threshold (cut-off) value that will yield the desired PPV (positive predictive value). It returns an array containing 5 values: a suggested threshold value, number of true positives, number of false positives, number of true negatives and number of false negatives.

Parameters:
data - should be a 2-by-n array containing data values in the first dimension and target outputs (+/-1) in the second dimension.

getAllClassificationData

public static double[] getAllClassificationData(double[][] data,
                                                double threshold)
getAllClassificationData returns the numbers of true positives, false positives, true negatives and false negatives, given a data array and a threshold (cut-off).

Parameters:
data - should be a 2-by-n array containing data values in the first dimension and target outputs (+/-1) in the second dimension.