You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2021/07/20 16:46:38 UTC

[commons-math] branch master updated: Userguide.

This is an automated email from the ASF dual-hosted git repository.

erans pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-math.git


The following commit(s) were added to refs/heads/master by this push:
     new e39ad3c  Userguide.
e39ad3c is described below

commit e39ad3c984966a8798339f3187765319a88023d1
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Tue Jul 20 18:46:16 2021 +0200

    Userguide.
---
 src/site/xdoc/userguide/distribution.xml | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/src/site/xdoc/userguide/distribution.xml b/src/site/xdoc/userguide/distribution.xml
index 7d5c723..6a21aa0 100644
--- a/src/site/xdoc/userguide/distribution.xml
+++ b/src/site/xdoc/userguide/distribution.xml
@@ -63,17 +63,16 @@
                   href="empirical">
         <p>
           Using the <code>EmpiricalDistribution</code> class, you can generate data based on
-          the values in an input file:
+          a given set of values:
 
           <source>
+double[] input = load("data.txt"); // Get some data.
 int binCount = 500;
-EmpiricalDistribution empDist = new EmpiricalDistribution(binCount);
-empDist.load("data.txt");
-RealDistribution.Sampler sampler = empDist.createSampler(RandomSource.MT.create());
+EmpiricalDistribution empDist = EmpiricalDistribution.from(binCount, input);
+ContinuousDistribution.Sampler sampler = empDist.createSampler(RandomSource.MT.create());
 double value = sampler.nextDouble(); </source>
 
-          The entire input file is read and a probability density function is estimated
-          based on data from the file.
+          The probability density function is estimated from the data passed as input.
           The estimation method is essentially the
           <a href="http://nedwww.ipac.caltech.edu/level5/March02/Silverman/Silver2_6.html">
             Variable Kernel Method</a> with Gaussian smoothing.
@@ -81,8 +80,7 @@ double value = sampler.nextDouble(); </source>
           matches the empirical distribution (i.e. if you generate a large number of
           such values, their distribution should "look like" the distribution of the
           values in the input file.
-          The values are not stored in memory in this case either, so there is no limit to the
-          size of the input file.
+          The input values are not stored in memory.
         </p>
       </subsection>
     </section>