Class StandardDeviationVisitor

Object
StandardDeviationVisitor
All Implemented Interfaces:
FeatureVisitor, FeatureAttributeVisitor, FeatureCalc

public class StandardDeviationVisitor extends Object implements FeatureCalc, FeatureAttributeVisitor
Determines the standard deviation.
            ----------------------------
            |  1   ---
 Std dev =  | ___  \   ( x - mean ) ^ 2
           \|  N   /__
 
aka std dev = sqrt((sum((x-mean)^2))/N) where N is the number of samples.

It uses the rolling variance algorithm described here: http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance#On-line_algorithm

Author:
Cory Horner, Refractions Research Inc., Andrea Aime, GeoSolutions
  • Constructor Details

    • StandardDeviationVisitor

      public StandardDeviationVisitor(Expression expr)
      Constructs a standard deviation visitor based on the specified expression
  • Method Details

    • init

      public void init(SimpleFeatureCollection collection)
    • getExpression

      public Expression getExpression()
    • setValue

      public void setValue(Object value)
    • getExpressions

      public List<Expression> getExpressions()
      Description copied from interface: FeatureAttributeVisitor
      List of expressions used by visitor.
      Specified by:
      getExpressions in interface FeatureAttributeVisitor
    • getResultType

      public Optional<List<Class>> getResultType(List<Class> inputTypes)
      Description copied from interface: FeatureAttributeVisitor
      Returns the expected output type given the input type.
      Specified by:
      getResultType in interface FeatureAttributeVisitor
      Parameters:
      inputTypes - The type of the input expressions
    • getResult

      public CalcResult getResult()
      Description copied from interface: FeatureCalc
      Returns the result of the calculation as a handy object which can be merged and modified.
      Specified by:
      getResult in interface FeatureCalc
      Returns:
      the results of the calculation
    • visit

      public void visit(SimpleFeature feature)
    • visit

      public void visit(Feature feature)
      Description copied from interface: FeatureVisitor
      Visit the provided feature.

      Please consult the documentation for the FeatureCollection you are visiting to learn more - the provided feature may be invalid, or read only.

      Specified by:
      visit in interface FeatureVisitor
    • reset

      public void reset()
    • getMean

      public double getMean()
      mean value generated when calcualting standard deviation
    • getNaNCount

      public int getNaNCount()
      Returns:
      the number of features which returned a NaN
    • getNullCount

      public int getNullCount()
      Returns:
      the number of features which returned a null