gov.sandia.cognition.learning.function.scalar
Class KolmogorovSmirnovEvaluator

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.evaluator.AbstractStatefulEvaluator<Double,Double,FiniteCapacityBuffer<Double>>
          extended by gov.sandia.cognition.learning.function.scalar.KolmogorovSmirnovEvaluator
All Implemented Interfaces:
Evaluator<Double,Double>, StatefulEvaluator<Double,Double,FiniteCapacityBuffer<Double>>, CloneableSerializable, Serializable, Cloneable

public class KolmogorovSmirnovEvaluator
extends AbstractStatefulEvaluator<Double,Double,FiniteCapacityBuffer<Double>>

You can specify a particular CDF. It accepts a double sample value which is buffered inside this class in a finite capacity buffer. The evaluation uses the entire contents of that buffer to compute the null hypothesis probability.

Author:
jdmorr
See Also:
Serialized Form

Field Summary
protected  CumulativeDistributionFunction<Double> cdf
          The cumulative distribution function to base the evaluator on.
static int DEFAULT_CAPACITY
          Default capacity, 100.
static CumulativeDistributionFunction<Double> DEFAULT_CDF
          Default CDF, a 3-DOF Chi-Square.
 
Constructor Summary
KolmogorovSmirnovEvaluator()
          Creates a new KolmogorovSmirnovEvaluator.
KolmogorovSmirnovEvaluator(CumulativeDistributionFunction<Double> cdf, int capacity)
          Creates a new KolmogorovSmirnovEvaluator.
 
Method Summary
 KolmogorovSmirnovEvaluator clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
 FiniteCapacityBuffer<Double> createDefaultState()
          Creates a new default state object.
 Double evaluate(Double value)
          takes in the double value and adds it to finite capacity buffer then computes the KS null hypothesis probability on the samples in the buffer against the particular CDF specified.
 int getCapacity()
          Getter for capacity
 CumulativeDistributionFunction<Double> getCDF()
          Getter for cdf
 void setCapacity(int capacity)
          Setter for capacity
 void setCDF(CumulativeDistributionFunction<Double> cdf)
          Setter for cdf
 
Methods inherited from class gov.sandia.cognition.evaluator.AbstractStatefulEvaluator
evaluate, getState, resetState, setState
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_CAPACITY

public static final int DEFAULT_CAPACITY
Default capacity, 100.

See Also:
Constant Field Values

DEFAULT_CDF

public static final CumulativeDistributionFunction<Double> DEFAULT_CDF
Default CDF, a 3-DOF Chi-Square.


cdf

protected CumulativeDistributionFunction<Double> cdf
The cumulative distribution function to base the evaluator on.

Constructor Detail

KolmogorovSmirnovEvaluator

public KolmogorovSmirnovEvaluator()
Creates a new KolmogorovSmirnovEvaluator.


KolmogorovSmirnovEvaluator

public KolmogorovSmirnovEvaluator(CumulativeDistributionFunction<Double> cdf,
                                  int capacity)
Creates a new KolmogorovSmirnovEvaluator.

Parameters:
cdf - The cumulative distribution function to base the evaluator on.
capacity - The capacity of the state.
Method Detail

clone

public KolmogorovSmirnovEvaluator clone()
Description copied from class: AbstractCloneableSerializable
This makes public the clone method on the Object class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call super.clone() to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in ObjectUtil may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use super.clone() as the basis for your implementation.

Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractStatefulEvaluator<Double,Double,FiniteCapacityBuffer<Double>>
Returns:
A clone of this object.

evaluate

public Double evaluate(Double value)
takes in the double value and adds it to finite capacity buffer then computes the KS null hypothesis probability on the samples in the buffer against the particular CDF specified.

Parameters:
value - a sample value
Returns:
null hypothesis probability

getCDF

public CumulativeDistributionFunction<Double> getCDF()
Getter for cdf

Returns:
The cumulative distribution function to base the evaluator on.

setCDF

public void setCDF(CumulativeDistributionFunction<Double> cdf)
Setter for cdf

Parameters:
cdf - The cumulative distribution function to base the evaluator on.

createDefaultState

public FiniteCapacityBuffer<Double> createDefaultState()
Description copied from interface: StatefulEvaluator
Creates a new default state object.

Returns:
A new default state object.

getCapacity

public int getCapacity()
Getter for capacity

Returns:
The capacity of the state.

setCapacity

public void setCapacity(int capacity)
Setter for capacity

Parameters:
capacity - The capacity of the state.