ec.app.sequence
Class SequenceClassificationProblem

java.lang.Object
  extended by ec.Problem
      extended by ec.gp.GPProblem
          extended by ec.app.sequence.SequenceClassificationProblem
All Implemented Interfaces:
ec.Prototype, ec.Setup, ec.simple.SimpleProblemForm, java.io.Serializable, java.lang.Cloneable

public class SequenceClassificationProblem
extends ec.gp.GPProblem
implements ec.simple.SimpleProblemForm

Basic Fitness assessment code. This is meant to be generic for any sequence classification problem. What we do is read the parameters for data file that has positive and negative sequences. Format of file should be SEQUENCE \t label like ACTTGGCTTGTTGGTTAAGGTTATG.........TAGA 1 ACGTTGGTTGAAGGTTAAGGTTATG.........GAGA -1 etc It uses the basic fitness function as TruePositiveRatio * Math.abs(InformationGain )as fitness. TruePosiiveRatio ~ to Precision value and InformationGain as Discrimination factor. KozaFitness is about mimimization, so we do 1/1+fitness to get the koza fitness.

Author:
udaykamath
See Also:
Serialized Form

Field Summary
static double MEDIUM
           
static java.lang.String POSITIVE_FILE_NAME_PARAM
           
static double SMALL
          The small deviation allowed in double comparisons.
 
Fields inherited from class ec.gp.GPProblem
data, P_DATA, P_GPPROBLEM, P_STACK, stack
 
Fields inherited from class ec.Problem
P_PROBLEM
 
Constructor Summary
SequenceClassificationProblem()
           
 
Method Summary
static double entropyConditionedOnColumns(double[][] matrix)
          Computes conditional entropy of the rows given the columns.
static double entropyConditionedOnRows(double[][] matrix)
          Computes conditional entropy of the columns given the rows.
static boolean eq(double a, double b)
          Tests if a is equal to b.
 void evaluate(ec.EvolutionState state, ec.Individual ind, int subpopulation, int threadnum)
          Evaluates the individual in ind, if necessary (perhaps not evaluating them if their evaluated flags are true), and sets their fitness appropriately.
 org.biojava.bio.symbol.SymbolList getCurrentSequence()
           
 org.biojava.utils.regex.PatternFactory getFactory(int thread)
           
 void setup(ec.EvolutionState state, ec.util.Parameter base)
          Sets up the object by reading it from the parameters stored in state, built off of the parameter base base.
 
Methods inherited from class ec.gp.GPProblem
clone, defaultBase
 
Methods inherited from class ec.Problem
canEvaluate, closeContacts, describe, describe, finishEvaluating, initializeContacts, prepareToEvaluate, reinitializeContacts
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ec.simple.SimpleProblemForm
describe
 

Field Detail

SMALL

public static double SMALL
The small deviation allowed in double comparisons.


MEDIUM

public static double MEDIUM

POSITIVE_FILE_NAME_PARAM

public static final java.lang.String POSITIVE_FILE_NAME_PARAM
See Also:
Constant Field Values
Constructor Detail

SequenceClassificationProblem

public SequenceClassificationProblem()
Method Detail

getFactory

public org.biojava.utils.regex.PatternFactory getFactory(int thread)

setup

public void setup(ec.EvolutionState state,
                  ec.util.Parameter base)
Description copied from interface: ec.Prototype
Sets up the object by reading it from the parameters stored in state, built off of the parameter base base. If an ancestor implements this method, be sure to call super.setup(state,base); before you do anything else.

For prototypes, setup(...) is typically called once for the prototype instance; cloned instances do not receive the setup(...) call. setup(...) may be called more than once; the only guarantee is that it will get called at least once on an instance or some "parent" object from which it was ultimately cloned.

Specified by:
setup in interface ec.Prototype
Specified by:
setup in interface ec.Setup
Overrides:
setup in class ec.gp.GPProblem

evaluate

public void evaluate(ec.EvolutionState state,
                     ec.Individual ind,
                     int subpopulation,
                     int threadnum)
Description copied from interface: ec.simple.SimpleProblemForm
Evaluates the individual in ind, if necessary (perhaps not evaluating them if their evaluated flags are true), and sets their fitness appropriately.

Specified by:
evaluate in interface ec.simple.SimpleProblemForm

entropyConditionedOnColumns

public static double entropyConditionedOnColumns(double[][] matrix)
Computes conditional entropy of the rows given the columns.

Parameters:
matrix - the contingency table
Returns:
the conditional entropy of the rows given the columns

entropyConditionedOnRows

public static double entropyConditionedOnRows(double[][] matrix)
Computes conditional entropy of the columns given the rows.

Parameters:
matrix - the contingency table
Returns:
the conditional entropy of the columns given the rows

eq

public static boolean eq(double a,
                         double b)
Tests if a is equal to b.

Parameters:
a - a double
b - a double

getCurrentSequence

public org.biojava.bio.symbol.SymbolList getCurrentSequence()