Re: math: how to initialize a custom prob. distribution function

2023-09-29 Thread Alex Herbert
On Fri, 29 Sept 2023 at 18:49, Siddharth Jain  wrote:
>
> thanks. i see this is filed under legacy namespace with the comment
> Implementations
> of common discrete and continuous distributions. [Mostly moved to the
> "Commons Statistics" project (cf. JIRA: MATH-1443).]
> i then checked
> https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/allclasses-noframe.html
> but could not see this class there. should i still use commons-math? and
> the 4.0-beta1 does not seem to be in maven repository. could i get link to
> mvn coordinates if its published on maven?

https://central.sonatype.com/artifact/org.apache.commons/commons-math4-legacy

There are some distribution classes that remain in Commons Math as
they use more math code than just the functions required to implement
standard distributions.

The legacy module contains most of what was in Commons Math 3. This is
code that has not been refactored into modules within the modular
Commons Math 4 layout, or undergone a complete rewrite as a new
project (see Commons RNG, Numbers, Statistics and Geometry).

Alex

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



Re: math: how to initialize a custom prob. distribution function

2023-09-29 Thread Siddharth Jain
thanks. i see this is filed under legacy namespace with the comment
Implementations
of common discrete and continuous distributions. [Mostly moved to the
"Commons Statistics" project (cf. JIRA: MATH-1443).]
i then checked
https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/allclasses-noframe.html
but could not see this class there. should i still use commons-math? and
the 4.0-beta1 does not seem to be in maven repository. could i get link to
mvn coordinates if its published on maven?

On Fri, Sep 29, 2023 at 10:10 AM Alex Herbert 
wrote:

> This may be what you require:
>
>
> https://commons.apache.org/proper/commons-math/javadocs/api-4.0-beta1/org/apache/commons/math4/legacy/distribution/EmpiricalDistribution.html
>
> You will have to convert your float values to double and then specify
> the bin size:
>
> float[] x = ...
> int bins = 100;
> ContinuousDistribution d = EmpiricalDistribution.from(bins,
> IntStream.range(0, x.length).mapToDouble(i -> x[i]).toArray());
>
> On Fri, 29 Sept 2023 at 17:44, Siddharth Jain  wrote:
> >
> > I have a vector float[] x containing samples of a random variable. I
> would
> > like to initialize a prob. distribution fn. using these samples and then
> be
> > able to call methods like
> >
> https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/org/apache/commons/statistics/distribution/ContinuousDistribution.html
> >
> > I am looking for an API like:
> >
> > var f = ContinuousDistribution.of(x)
> >
> > is this available in commons-math? thanks.
> >
> > S.
>
> -
> To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
> For additional commands, e-mail: user-h...@commons.apache.org
>
>


Re: math: how to initialize a custom prob. distribution function

2023-09-29 Thread Alex Herbert
This may be what you require:

https://commons.apache.org/proper/commons-math/javadocs/api-4.0-beta1/org/apache/commons/math4/legacy/distribution/EmpiricalDistribution.html

You will have to convert your float values to double and then specify
the bin size:

float[] x = ...
int bins = 100;
ContinuousDistribution d = EmpiricalDistribution.from(bins,
IntStream.range(0, x.length).mapToDouble(i -> x[i]).toArray());

On Fri, 29 Sept 2023 at 17:44, Siddharth Jain  wrote:
>
> I have a vector float[] x containing samples of a random variable. I would
> like to initialize a prob. distribution fn. using these samples and then be
> able to call methods like
> https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/org/apache/commons/statistics/distribution/ContinuousDistribution.html
>
> I am looking for an API like:
>
> var f = ContinuousDistribution.of(x)
>
> is this available in commons-math? thanks.
>
> S.

-
To unsubscribe, e-mail: user-unsubscr...@commons.apache.org
For additional commands, e-mail: user-h...@commons.apache.org



math: how to initialize a custom prob. distribution function

2023-09-29 Thread Siddharth Jain
I have a vector float[] x containing samples of a random variable. I would
like to initialize a prob. distribution fn. using these samples and then be
able to call methods like
https://commons.apache.org/proper/commons-statistics/commons-statistics-distribution/apidocs/org/apache/commons/statistics/distribution/ContinuousDistribution.html

I am looking for an API like:

var f = ContinuousDistribution.of(x)

is this available in commons-math? thanks.

S.