Package com.cloudera.science.quantile

Examples of com.cloudera.science.quantile.QuantileEstimator


    Object o = input.get(0);
    if (!(o instanceof DataBag)) {
      throw new IOException("Expected input to be a bag, but got: " + o.getClass().getName());
    }
    DataBag inputBag = (DataBag) o;
    QuantileEstimator estimator = createEstimator();
   
    for (Tuple t : inputBag) {
      if (t != null && t.get(0) != null) {
        estimator.add(((Number) t.get(0)).doubleValue());
      }
    }
   
    List<Double> quantiles = estimator.getQuantiles();
    for (int i = 0; i < quantiles.size(); i++) {
      output.add(tupleFactory.newTuple(ImmutableList.of(i, quantiles.get(i))));
    }
    return output;
  }
View Full Code Here

TOP

Related Classes of com.cloudera.science.quantile.QuantileEstimator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.