|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectgeneticWedge.gp.Individual
public class Individual
The Individual class represents a single tree (program). A population is usually made up of a large number of Individuals.
Constructor Summary | |
---|---|
Individual(IndividualDescriptor.IndividualGrowMethod growMethod,
int treeDepth,
int minDepth,
Function[] functions,
Input[] inputs,
Constant[] constants)
Conctructs an Individual from the parameters provided. |
|
Individual(IndividualDescriptor.IndividualGrowMethod growMethod,
int treeDepth,
int minTreeDepth,
Function[] functions,
Input[] inputs,
Constant[] constants,
double growFunctionProportion)
Constructs an Individual from the parameters provided. |
|
Individual(IndividualDescriptor descriptor)
Constructs an Individual according to parameters held by the IndividualDescriptor. |
|
Individual(int treeDepth,
Function[] functions,
Input[] inputs,
Constant[] constants,
double growFunctionProportion)
Constructs an Individual from the parameters provided, using the GROW method. |
|
Individual(java.util.Vector<Component> newNodes,
Input[] inputs,
Constant[] constants)
Constructs a new Individual containing the Components in newNodes in the specified order. |
|
Individual(java.util.Vector<Component> newNodes,
Terminal[] terminals)
Constructs a new Individual containing the Components in newNodes in the specified order. |
Method Summary | |
---|---|
Individual |
clone()
Creates a clone of this Individual, containing the same components in the same tree structure |
boolean |
equals(Individual comparison)
This method will only return true if all of the nodes in the comparison Individual refer to the same Component objects as the reference Individual. |
double |
getAbsoluteError(double[][] inputs,
double[] targetOutputs)
Returns the Absolute Error for the provided dataset. |
double |
getAbsoluteError(double[] inputs,
double targetOutput)
Returns the absolute error for the single data-point provided. |
int[] |
getAllClassificationData(double[][] inputs,
double[] targetOutputs,
double threshold,
boolean useCachedValues,
boolean saveValues)
This returns an array containing 4 values - True Positives, False Positives, True Negatives and False Negatives. |
java.awt.geom.Point2D.Double[] |
getAllRECCoordinates(double[][] inputs,
double[] targetOutputs,
AbstractPopulation.FitnessFunction fitnessFunction)
This method ia used in calculateing AOREC values. |
java.awt.geom.Point2D.Double[] |
getAllROCCoordinates(double[][] inputs,
double[] targetOutputs)
This method is used in calculating AUROC values. |
java.awt.geom.Point2D.Double[] |
getAllROCCoordinates(double[] outputs,
double[] targetOutputs)
This method is used in calculating AUROC values. |
double |
getAOREC(double[][] inputs,
double[] targetOutputs,
AbstractPopulation.FitnessFunction fitnessFunction)
Returns the Area over the REC curve (AOREC) during a regression task. |
double |
getAOREC(double[][] inputs,
double[] targetOutputs,
AbstractPopulation.FitnessFunction fitnessFunction,
boolean useSavedValue)
Returns the Area over the REC curve (AOREC) during a regression task. |
double |
getAOREC(double[][] inputs,
double[] targetOutputs,
int sampleSize,
AbstractPopulation.FitnessFunction fitnessFunction)
Returns the Area over the REC curve (AOREC) during a regression task. |
double |
getAOREC(double[][] inputs,
double[] targetOutputs,
int sampleSize,
AbstractPopulation.FitnessFunction fitnessFunction,
boolean useSavedValue)
Returns the Area over the REC curve (AOREC) during a regression task. |
double |
getAUROC(double[][] inputs,
double[] targetOutputs)
Calculates and returns the Area under the ROC curve (AUROC) during a classification task, using all of the provided data. |
double |
getAUROC(double[][] inputs,
double[] targetOutputs,
boolean useSavedValue,
boolean saveValues)
Calculates and returns the Area under the ROC curve (AUROC) during a classification task, using all of the provided data. |
double |
getAUROC(double[][] inputs,
double[] targetOutputs,
int sampleSize)
Returns the Area under the ROC curve (AUROC) during a classification task. |
double |
getAUROC(double[][] inputs,
double[] targetOutputs,
int sampleSize,
boolean useSavedValue,
boolean saveValues)
Returns the Area under the ROC curve (AUROC) during a classification task. |
double |
getBestROCThreshold(double[][] inputs,
double[] targetOutputs)
This method returns the threshold value that results in the point on the ROC closest to (0,1). |
double |
getBestROCThreshold(double[][] inputs,
double[] targetOutputs,
boolean useCachedValue)
If useCachedValue is true, inputs and targetOutputs will only be used if a cached value is not available. |
double |
getBestROCThreshold(double[] outputs,
double[] targetOutputs)
This method returns the threshold value that results in the point on the ROC closest to (0,1). |
double |
getCombinedClassificationError(double[][] inputs,
double[] targetOutputs,
boolean useSavedValue,
boolean useSavedThresholdValue,
boolean saveValues)
This is the sqrt of the sum of the squares of the false negative fraction and the false positive fraction during classification. |
double |
getCombinedClassificationError(double[][] inputs,
double[] targetOutputs,
int sampleSize,
boolean useSavedValue,
boolean useSavedThresholdValue,
boolean saveValues)
This is the sqrt of the sum of the squares of the false negative fraction and the false positive fraction during classification. |
int |
getDepth()
Returns the depth of this Individual. |
java.lang.String |
getExpandedStringFunction()
Returns the function represented by this Individual, with all terms expanded out and collected. |
double |
getGrowFunctionProportion()
Returns the probability of a node selected during growth being a Function (rather than a Terminal). |
static Individual |
getIndividualFromString(java.lang.String string,
Function[] functions,
Input[] inputs,
Constant[] constants)
|
int |
getLength()
Returns the length (number of nodes) in this Individual. |
int |
getModificationPointFromPoissonDistribution(double lambda,
boolean reverseDistribution)
lambda should be a number between 0.0 and 1.0, i.e. |
int |
getModificationPointFromPoissonDistribution(double lambda,
java.util.Vector<java.lang.Integer> selectedIndices,
boolean reverseDistribution)
lambda should be a number between 0.0 and 1.0, i.e. |
double |
getMSE(double[][] inputs,
double[] targetOutputs)
Returns the Mean Square Error for the provided dataset. |
double |
getNegativePredictiveValue(double[][] inputs,
double[] targetOutputs)
Returns the Negative Predictive Value (NPV) during a classification task. |
double |
getNegativePredictiveValue(double[][] inputs,
double[] targetOutputs,
double threshold)
Returns the Negative Predictive Value (NPV) during a classification task. |
java.util.Vector<Component> |
getNodes()
Returns the Components within this Individual in the correct order, working from root to leaf and left to right. |
double |
getNumberCorrectBinary(double[][] inputs,
double[] targetOutputs)
Returns the number of correctly classified outputs from the provided dataset. |
double |
getNumberCorrectBinary(double[][] inputs,
double[] targetOutputs,
double threshold)
Returns the number of correctly classified outputs from the provided dataset. |
double |
getOutput(double[] input)
Returns the output of this Individual, given the provided input vector. |
double |
getPositivePredictiveValue(double[][] inputs,
double[] targetOutputs)
Returns the Positive Predictive Value (PPV) during a classification task. |
double |
getPositivePredictiveValue(double[][] inputs,
double[] targetOutputs,
double threshold)
Returns the Positive Predictive Value (PPV) during a classification task. |
java.awt.geom.Point2D.Double[] |
getRECCoordinates(double[][] inputs,
double[] targetOutputs,
int sampleSize,
AbstractPopulation.FitnessFunction fitnessFunction)
This method ia used in calculateing AOREC values. |
double |
getRMSE(double[][] inputs,
double[] targetOutputs)
Returns the Root Mean Square Error for the provided dataset. |
java.awt.geom.Point2D.Double[] |
getROCCoordinates(double[][] inputs,
double[] targetOutputs,
int sampleSize)
This method is used in calculateing AUROC values. |
double |
getSensitivity(double[][] inputs,
double[] targetOutputs)
Returns the sensitivity during a classification task. |
double |
getSensitivity(double[][] inputs,
double[] targetOutputs,
double threshold)
Returns the sensitivity during a classification task. |
double |
getSpecificity(double[][] inputs,
double[] targetOutputs)
Returns the specificity during a classification task. |
double |
getSpecificity(double[][] inputs,
double[] targetOutputs,
double threshold)
Returns the specificity during a classification task. |
double |
getSquaredError(double[] inputs,
double targetOutput)
Returns the square of the error for the single data-point provided. |
double |
getThresholdAdjustedOutput(double[] input)
Returns the threshold adjusted error, i.e. |
void |
setGrowFunctionProportion(double proportion)
Sets the probability of a node selected during growth being a Function (rather than a Terminal). |
java.lang.String |
toString()
Returns a string representation of this Individual. |
java.lang.String |
toStringFunction()
Returns a string representation of this Individual in the format of a mathematical function. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Individual(IndividualDescriptor descriptor) throws InvalidFractionException
InvalidFractionException
public Individual(IndividualDescriptor.IndividualGrowMethod growMethod, int treeDepth, int minTreeDepth, Function[] functions, Input[] inputs, Constant[] constants, double growFunctionProportion) throws InvalidFractionException
InvalidFractionException
public Individual(int treeDepth, Function[] functions, Input[] inputs, Constant[] constants, double growFunctionProportion) throws InvalidFractionException
InvalidFractionException
public Individual(IndividualDescriptor.IndividualGrowMethod growMethod, int treeDepth, int minDepth, Function[] functions, Input[] inputs, Constant[] constants)
minDepth
- This sets the minimum depth of the tree created. It only applies if the GROW method is used; if the FULL method is applied minDepth = treeDepthpublic Individual(java.util.Vector<Component> newNodes, Terminal[] terminals)
terminals
- The terminals should be provided in order to allow the inputs to be changed for different data.public Individual(java.util.Vector<Component> newNodes, Input[] inputs, Constant[] constants)
inputs
- The inputs should be provided in order to allow the inputs to be changed for different data.Method Detail |
---|
public static Individual getIndividualFromString(java.lang.String string, Function[] functions, Input[] inputs, Constant[] constants)
public Individual clone()
clone
in class java.lang.Object
public double getRMSE(double[][] inputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public double getMSE(double[][] inputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public double getAbsoluteError(double[][] inputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public double getNumberCorrectBinary(double[][] inputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public double getNumberCorrectBinary(double[][] inputs, double[] targetOutputs, double threshold) throws InvalidInputSizeException
InvalidInputSizeException
public int[] getAllClassificationData(double[][] inputs, double[] targetOutputs, double threshold, boolean useCachedValues, boolean saveValues) throws InvalidInputSizeException
InvalidInputSizeException
public double getSensitivity(double[][] inputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public double getSensitivity(double[][] inputs, double[] targetOutputs, double threshold) throws InvalidInputSizeException
threshold
- The threshold used during classification. Outputs which exceed the threshold are considered to be 'true'.
InvalidInputSizeException
public double getSpecificity(double[][] inputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public double getSpecificity(double[][] inputs, double[] targetOutputs, double threshold) throws InvalidInputSizeException
threshold
- The threshold used during classification. Outputs which exceed the threshold are considered to be 'true'.
InvalidInputSizeException
public double getPositivePredictiveValue(double[][] inputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public double getPositivePredictiveValue(double[][] inputs, double[] targetOutputs, double threshold) throws InvalidInputSizeException
threshold
- The threshold used during classification. Outputs which exceed the threshold are considered to be 'true'.
InvalidInputSizeException
public double getNegativePredictiveValue(double[][] inputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public double getNegativePredictiveValue(double[][] inputs, double[] targetOutputs, double threshold) throws InvalidInputSizeException
threshold
- The threshold used during classification. Outputs which exceed the threshold are considered to be 'true'.
InvalidInputSizeException
public double getAUROC(double[][] inputs, double[] targetOutputs, int sampleSize) throws InvalidInputSizeException
sampleSize
- The number of data to be sampled when estimating the AUROC. 100 points is usually enough to give a reasonable estimate.
InvalidInputSizeException
public double getAUROC(double[][] inputs, double[] targetOutputs, int sampleSize, boolean useSavedValue, boolean saveValues) throws InvalidInputSizeException
sampleSize
- The number of data to be sampled when estimating the AUROC. 100 points is usually enough to give a reasonable estimate.useSavedValue
- If true the AUROC will not be recalculated from the data provided. Instead the last saved value will be returned.saveValues
- This flag indicates that the AUROC value should be saved by this Individual. It may later be returned by calling this method with useSavedValue = true.
InvalidInputSizeException
public double getAUROC(double[][] inputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public double getAUROC(double[][] inputs, double[] targetOutputs, boolean useSavedValue, boolean saveValues) throws InvalidInputSizeException
useSavedValue
- If true the AUROC will not be recalculated from the data provided. Instead the last saved value will be returned.saveValues
- This flag indicates that the AUROC value should be saved by this Individual. It may later be returned by calling this method with useSavedValue = true.
InvalidInputSizeException
public double getCombinedClassificationError(double[][] inputs, double[] targetOutputs, int sampleSize, boolean useSavedValue, boolean useSavedThresholdValue, boolean saveValues) throws InvalidInputSizeException
InvalidInputSizeException
public double getCombinedClassificationError(double[][] inputs, double[] targetOutputs, boolean useSavedValue, boolean useSavedThresholdValue, boolean saveValues) throws InvalidInputSizeException
InvalidInputSizeException
public double getBestROCThreshold(double[][] inputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public double getBestROCThreshold(double[] outputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public double getBestROCThreshold(double[][] inputs, double[] targetOutputs, boolean useCachedValue) throws InvalidInputSizeException
InvalidInputSizeException
public java.awt.geom.Point2D.Double[] getAllROCCoordinates(double[][] inputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public java.awt.geom.Point2D.Double[] getAllROCCoordinates(double[] outputs, double[] targetOutputs) throws InvalidInputSizeException
InvalidInputSizeException
public java.awt.geom.Point2D.Double[] getROCCoordinates(double[][] inputs, double[] targetOutputs, int sampleSize) throws InvalidInputSizeException
InvalidInputSizeException
public double getAOREC(double[][] inputs, double[] targetOutputs, int sampleSize, AbstractPopulation.FitnessFunction fitnessFunction) throws InvalidInputSizeException
sampleSize
- The number of data to be sampled when estimating the AOREC. 100 points is usually enough to give a reasonable estimate.
InvalidInputSizeException
public double getAOREC(double[][] inputs, double[] targetOutputs, int sampleSize, AbstractPopulation.FitnessFunction fitnessFunction, boolean useSavedValue) throws InvalidInputSizeException
sampleSize
- The number of data to be sampled when estimating the AOREC. 100 points is usually enough to give a reasonable estimate.useSavedValue
- If true, this method will return the last calculated AOREC value rather than recalculating it.
InvalidInputSizeException
public double getAOREC(double[][] inputs, double[] targetOutputs, AbstractPopulation.FitnessFunction fitnessFunction) throws InvalidInputSizeException
InvalidInputSizeException
public double getAOREC(double[][] inputs, double[] targetOutputs, AbstractPopulation.FitnessFunction fitnessFunction, boolean useSavedValue) throws InvalidInputSizeException
useSavedValue
- If true, this method will return the last calculated AOREC value rather than recalculating it.
InvalidInputSizeException
public java.awt.geom.Point2D.Double[] getAllRECCoordinates(double[][] inputs, double[] targetOutputs, AbstractPopulation.FitnessFunction fitnessFunction) throws InvalidInputSizeException
InvalidInputSizeException
public java.awt.geom.Point2D.Double[] getRECCoordinates(double[][] inputs, double[] targetOutputs, int sampleSize, AbstractPopulation.FitnessFunction fitnessFunction) throws InvalidInputSizeException
InvalidInputSizeException
public double getSquaredError(double[] inputs, double targetOutput) throws InvalidInputSizeException
InvalidInputSizeException
public double getAbsoluteError(double[] inputs, double targetOutput) throws InvalidInputSizeException
InvalidInputSizeException
public double getThresholdAdjustedOutput(double[] input) throws InvalidInputSizeException
InvalidInputSizeException
public double getOutput(double[] input) throws InvalidInputSizeException
InvalidInputSizeException
public java.lang.String getExpandedStringFunction()
public int getModificationPointFromPoissonDistribution(double lambda, boolean reverseDistribution)
public int getModificationPointFromPoissonDistribution(double lambda, java.util.Vector<java.lang.Integer> selectedIndices, boolean reverseDistribution)
public int getLength()
public int getDepth()
public void setGrowFunctionProportion(double proportion) throws InvalidFractionException
InvalidFractionException
public double getGrowFunctionProportion()
public java.util.Vector<Component> getNodes()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String toStringFunction()
public boolean equals(Individual comparison)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |