public class WilsonBinConf extends SimpleEvalFunc<org.apache.pig.data.Tuple>
Constructor requires the confidence interval (alpha) parameter, and the parameters are the number of positive (success) outcomes and the total number of observations. The UDF returns the (lower,upper) confidence interval.
Example:
-- the Wilsonian binomial proportion confidence interval for scoring
%declare WILSON_ALPHA 0.10
define WilsonBinConf datafu.pig.stats.WilsonBinConf('$WILSON_ALPHA');
bar = FOREACH foo GENERATE WilsonBinConf(successes, totals).lower as score;
quux = ORDER bar BY score DESC;
top = LIMIT quux 10;
Constructor and Description |
---|
WilsonBinConf(double alpha) |
WilsonBinConf(java.lang.String alpha) |
Modifier and Type | Method and Description |
---|---|
org.apache.pig.data.Tuple |
binconf(java.lang.Long x,
java.lang.Long n) |
org.apache.pig.data.Tuple |
call(java.lang.Number x,
java.lang.Number n) |
org.apache.pig.impl.logicalLayer.schema.Schema |
outputSchema(org.apache.pig.impl.logicalLayer.schema.Schema input)
Override outputSchema so we can verify the input schema at pig compile time, instead of runtime
|
exec, getReturnType
getContextProperties, getInstanceName, getInstanceProperties, onReady, setUDFContextSignature
public WilsonBinConf(double alpha)
public WilsonBinConf(java.lang.String alpha)
public org.apache.pig.data.Tuple call(java.lang.Number x, java.lang.Number n) throws java.io.IOException
java.io.IOException
public org.apache.pig.data.Tuple binconf(java.lang.Long x, java.lang.Long n) throws java.io.IOException
x
- The number of positive (success) outcomesn
- The number of observationsjava.io.IOException
- IOExceptionpublic org.apache.pig.impl.logicalLayer.schema.Schema outputSchema(org.apache.pig.impl.logicalLayer.schema.Schema input)
SimpleEvalFunc
outputSchema
in class SimpleEvalFunc<org.apache.pig.data.Tuple>
input
- input schema