public class GenericUDAFCovariance extends AbstractGenericUDAFResolver
| Modifier and Type | Class and Description |
|---|---|
static class |
GenericUDAFCovariance.GenericUDAFCovarianceEvaluator
Evaluate the variance using the algorithm described in
http://en.wikipedia.org/wiki/Algorithms_for_calculating_variance,
presumably by Pébay, Philippe (2008), in "Formulas for Robust,
One-Pass Parallel Computation of Covariances and Arbitrary-Order
Statistical Moments", Technical Report SAND2008-6212,
Sandia National Laboratories,
http://infoserve.sandia.gov/sand_doc/2008/086212.pdf
Incremental:
n : <count>
mx_n = mx_(n-1) + [x_n - mx_(n-1)]/n : <xavg>
my_n = my_(n-1) + [y_n - my_(n-1)]/n : <yavg>
c_n = c_(n-1) + (x_n - mx_(n-1))*(y_n - my_n) : <covariance * n>
Merge:
c_X = c_A + c_B + (mx_A - mx_B)*(my_A - my_B)*n_A*n_B/n_X
This one-pass algorithm is stable.
|
| Constructor and Description |
|---|
GenericUDAFCovariance() |
| Modifier and Type | Method and Description |
|---|---|
GenericUDAFEvaluator |
getEvaluator(TypeInfo[] parameters)
Get the evaluator for the parameter types.
|
getEvaluatorpublic GenericUDAFEvaluator getEvaluator(TypeInfo[] parameters) throws SemanticException
GenericUDAFResolverIf the class of the object does not implement Serializable, then we will create a new instance of the class at execution time.
getEvaluator in interface GenericUDAFResolvergetEvaluator in class AbstractGenericUDAFResolverparameters - The types of the parameters. We need the type information to know
which evaluator class to use.SemanticExceptionCopyright © 2024 The Apache Software Foundation. All rights reserved.