/** * Computes the empirical distribution using values from the file * in <code>valuesFileURL</code>, using the default number of bins. * <p> * <code>valuesFileURL</code> must exist and be * readable by *this at runtime.</p> * <p> * This method must be called before using <code>getNext()</code> * with <code>mode = DIGEST_MODE</code></p> * * @throws IOException if an I/O error occurs reading the input file */ public void computeDistribution() throws IOException { empiricalDistribution = new EmpiricalDistributionImpl(); empiricalDistribution.load(valuesFileURL); }
/** * Computes the empirical distribution using values from the file * in <code>valuesFileURL</code>, using the default number of bins. * <p> * <code>valuesFileURL</code> must exist and be * readable by *this at runtime.</p> * <p> * This method must be called before using <code>getNext()</code> * with <code>mode = DIGEST_MODE</code></p> * * @throws IOException if an I/O error occurs reading the input file */ public void computeDistribution() throws IOException { empiricalDistribution = new EmpiricalDistributionImpl(); empiricalDistribution.load(valuesFileURL); }
/** * Computes the empirical distribution using values from the file * in <code>valuesFileURL</code>, using the default number of bins. * <p> * <code>valuesFileURL</code> must exist and be * readable by *this at runtime.</p> * <p> * This method must be called before using <code>getNext()</code> * with <code>mode = DIGEST_MODE</code></p> * * @throws IOException if an I/O error occurs reading the input file */ public void computeDistribution() throws IOException { empiricalDistribution = new EmpiricalDistributionImpl(); empiricalDistribution.load(valuesFileURL); }
@Test public void testCalculatePercentile() { //given double[] values = new double[]{1,2,3,4,5}; EmpiricalDistribution distribution = new EmpiricalDistribution(values.length); distribution.load(values); //when double percentile = distribution.cumulativeProbability(4); //then assertThat(percentile).isEqualTo(0.8); }
/** * Computes the empirical distribution using values from the file * in <code>valuesFileURL</code> and <code>binCount</code> bins. * <p> * <code>valuesFileURL</code> must exist and be readable by this process * at runtime.</p> * <p> * This method must be called before using <code>getNext()</code> * with <code>mode = DIGEST_MODE</code></p> * * @param binCount the number of bins used in computing the empirical * distribution * @throws IOException if an error occurs reading the input file */ public void computeDistribution(int binCount) throws IOException { empiricalDistribution = new EmpiricalDistributionImpl(binCount); empiricalDistribution.load(valuesFileURL); mu = empiricalDistribution.getSampleStats().getMean(); sigma = empiricalDistribution.getSampleStats().getStandardDeviation(); }
/** * Computes the empirical distribution using values from the file * in <code>valuesFileURL</code> and <code>binCount</code> bins. * <p> * <code>valuesFileURL</code> must exist and be readable by this process * at runtime.</p> * <p> * This method must be called before using <code>getNext()</code> * with <code>mode = DIGEST_MODE</code></p> * * @param binCount the number of bins used in computing the empirical * distribution * @throws IOException if an error occurs reading the input file */ public void computeDistribution(int binCount) throws IOException { empiricalDistribution = new EmpiricalDistributionImpl(binCount); empiricalDistribution.load(valuesFileURL); mu = empiricalDistribution.getSampleStats().getMean(); sigma = empiricalDistribution.getSampleStats().getStandardDeviation(); }
/** * Computes the empirical distribution using values from the file * in <code>valuesFileURL</code> and <code>binCount</code> bins. * <p> * <code>valuesFileURL</code> must exist and be readable by this process * at runtime.</p> * <p> * This method must be called before using <code>getNext()</code> * with <code>mode = DIGEST_MODE</code></p> * * @param binCount the number of bins used in computing the empirical * distribution * @throws IOException if an error occurs reading the input file */ public void computeDistribution(int binCount) throws IOException { empiricalDistribution = new EmpiricalDistributionImpl(binCount); empiricalDistribution.load(valuesFileURL); mu = empiricalDistribution.getSampleStats().getMean(); sigma = empiricalDistribution.getSampleStats().getStandardDeviation(); }