[Lang] BigDecimalStatistics proposition

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lang] BigDecimalStatistics proposition

Aleksander Ściborek
Hi, I've come up with the idea of making easier using Stream with
BigDecimal class.
The idea is to create BigDecimalStatistics class which provide a convenient
way for calculating max, min, average and sum from BigDecimals from Stream.
I think that it's very suitable for commons library.
Should it be implemented in commons lang or commons math? I believe that
it's more suitable for commons lang
This is a link to Jira Ticket : LANG-1459
<https://issues.apache.org/jira/browse/LANG-1459>
Aleksander
Reply | Threaded
Open this post in threaded view
|

Re: [Lang] BigDecimalStatistics proposition

garydgregory
We have a Commons Statistics component that might be a fit.

Gary

On Tue, May 14, 2019, 17:34 Aleksander Ściborek <
[hidden email]> wrote:

> Hi, I've come up with the idea of making easier using Stream with
> BigDecimal class.
> The idea is to create BigDecimalStatistics class which provide a convenient
> way for calculating max, min, average and sum from BigDecimals from Stream.
> I think that it's very suitable for commons library.
> Should it be implemented in commons lang or commons math? I believe that
> it's more suitable for commons lang
> This is a link to Jira Ticket : LANG-1459
> <https://issues.apache.org/jira/browse/LANG-1459>
> Aleksander
>
Reply | Threaded
Open this post in threaded view
|

Re: [Lang] BigDecimalStatistics proposition

Eric Barnhill
Yes. This sounds great for commons-statistics. Other work in a similar vein
will be happening this summer by one of our GSOC mentees.

On Tue, May 14, 2019, 15:04 Gary Gregory <[hidden email]> wrote:

> We have a Commons Statistics component that might be a fit.
>
> Gary
>
> On Tue, May 14, 2019, 17:34 Aleksander Ściborek <
> [hidden email]> wrote:
>
> > Hi, I've come up with the idea of making easier using Stream with
> > BigDecimal class.
> > The idea is to create BigDecimalStatistics class which provide a
> convenient
> > way for calculating max, min, average and sum from BigDecimals from
> Stream.
> > I think that it's very suitable for commons library.
> > Should it be implemented in commons lang or commons math? I believe that
> > it's more suitable for commons lang
> > This is a link to Jira Ticket : LANG-1459
> > <https://issues.apache.org/jira/browse/LANG-1459>
> > Aleksander
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: [Lang] BigDecimalStatistics proposition

Aleksander Ściborek
Should I create a new Maven commons-statistics submodule for this? Besides
the BigDecimalStatistics I'm going to create support for downstream
operators for BigDecimals and maybe BigIntegers.

On Wed, 15 May 2019 at 03:36, Eric Barnhill <[hidden email]> wrote:

> Yes. This sounds great for commons-statistics. Other work in a similar vein
> will be happening this summer by one of our GSOC mentees.
>
> On Tue, May 14, 2019, 15:04 Gary Gregory <[hidden email]> wrote:
>
> > We have a Commons Statistics component that might be a fit.
> >
> > Gary
> >
> > On Tue, May 14, 2019, 17:34 Aleksander Ściborek <
> > [hidden email]> wrote:
> >
> > > Hi, I've come up with the idea of making easier using Stream with
> > > BigDecimal class.
> > > The idea is to create BigDecimalStatistics class which provide a
> > convenient
> > > way for calculating max, min, average and sum from BigDecimals from
> > Stream.
> > > I think that it's very suitable for commons library.
> > > Should it be implemented in commons lang or commons math? I believe
> that
> > > it's more suitable for commons lang
> > > This is a link to Jira Ticket : LANG-1459
> > > <https://issues.apache.org/jira/browse/LANG-1459>
> > > Aleksander
> > >
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: [Lang] BigDecimalStatistics proposition

Gilles Sadowski-2
Hi.

Le jeu. 16 mai 2019 à 22:45, Aleksander Ściborek
<[hidden email]> a écrit :
>
> Should I create a new Maven commons-statistics submodule for this?

[If the current idea is put the functionality in "Commons Statistics", you
should change this thread's "Subject:" line.]

Then, yes, there should be a new module.

> Besides
> the BigDecimalStatistics I'm going to create support for downstream
> operators for BigDecimals and maybe BigIntegers.

Is the goal to "only" mimic the JDK's "IntSummaryStatistics", or do you
have a specific use-case?
In the latter case, it will be worth considering how all the functionality in
Commons Math's "o.a.c.math4.stat.descriptive" package[1] will be
supported.

Regards,
Gilles

[1] https://gitbox.apache.org/repos/asf?p=commons-math.git;a=tree;f=src/main/java/org/apache/commons/math4/stat/descriptive



> On Wed, 15 May 2019 at 03:36, Eric Barnhill <[hidden email]> wrote:
>
> > Yes. This sounds great for commons-statistics. Other work in a similar vein
> > will be happening this summer by one of our GSOC mentees.
> >
> > On Tue, May 14, 2019, 15:04 Gary Gregory <[hidden email]> wrote:
> >
> > > We have a Commons Statistics component that might be a fit.
> > >
> > > Gary
> > >
> > > On Tue, May 14, 2019, 17:34 Aleksander Ściborek <
> > > [hidden email]> wrote:
> > >
> > > > Hi, I've come up with the idea of making easier using Stream with
> > > > BigDecimal class.
> > > > The idea is to create BigDecimalStatistics class which provide a
> > > convenient
> > > > way for calculating max, min, average and sum from BigDecimals from
> > > Stream.
> > > > I think that it's very suitable for commons library.
> > > > Should it be implemented in commons lang or commons math? I believe
> > that
> > > > it's more suitable for commons lang
> > > > This is a link to Jira Ticket : LANG-1459
> > > > <https://issues.apache.org/jira/browse/LANG-1459>
> > > > Aleksander
> > > >
> > >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Statistics] BigDecimalStatistics proposition

Aleksander Ściborek
Hi,
Right now I'm going to minic IntSummaryStatistics. Orginal idea had been to
create a BigDecimalAverager just for calculate an average in functional
style, but after I saw IntSummaryStatistics from JDK i deciced to exdends
functionality.

Regards, Aleksander

On Fri, 17 May 2019 at 00:24, Gilles Sadowski <[hidden email]> wrote:

> Hi.
>
> Le jeu. 16 mai 2019 à 22:45, Aleksander Ściborek
> <[hidden email]> a écrit :
> >
> > Should I create a new Maven commons-statistics submodule for this?
>
> [If the current idea is put the functionality in "Commons Statistics", you
> should change this thread's "Subject:" line.]
>
> Then, yes, there should be a new module.
>
> > Besides
> > the BigDecimalStatistics I'm going to create support for downstream
> > operators for BigDecimals and maybe BigIntegers.
>
> Is the goal to "only" mimic the JDK's "IntSummaryStatistics", or do you
> have a specific use-case?
> In the latter case, it will be worth considering how all the functionality
> in
> Commons Math's "o.a.c.math4.stat.descriptive" package[1] will be
> supported.
>
> Regards,
> Gilles
>
> [1]
> https://gitbox.apache.org/repos/asf?p=commons-math.git;a=tree;f=src/main/java/org/apache/commons/math4/stat/descriptive
>
>
>
> > On Wed, 15 May 2019 at 03:36, Eric Barnhill <[hidden email]>
> wrote:
> >
> > > Yes. This sounds great for commons-statistics. Other work in a similar
> vein
> > > will be happening this summer by one of our GSOC mentees.
> > >
> > > On Tue, May 14, 2019, 15:04 Gary Gregory <[hidden email]>
> wrote:
> > >
> > > > We have a Commons Statistics component that might be a fit.
> > > >
> > > > Gary
> > > >
> > > > On Tue, May 14, 2019, 17:34 Aleksander Ściborek <
> > > > [hidden email]> wrote:
> > > >
> > > > > Hi, I've come up with the idea of making easier using Stream with
> > > > > BigDecimal class.
> > > > > The idea is to create BigDecimalStatistics class which provide a
> > > > convenient
> > > > > way for calculating max, min, average and sum from BigDecimals from
> > > > Stream.
> > > > > I think that it's very suitable for commons library.
> > > > > Should it be implemented in commons lang or commons math? I believe
> > > that
> > > > > it's more suitable for commons lang
> > > > > This is a link to Jira Ticket : LANG-1459
> > > > > <https://issues.apache.org/jira/browse/LANG-1459>
> > > > > Aleksander
> > > > >
> > > >
> > >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [Statistics] BigDecimalStatistics proposition

Gilles Sadowski-2
Hello.

Le ven. 17 mai 2019 à 12:14, Aleksander Ściborek
<[hidden email]> a écrit :
>
> Hi,
> Right now I'm going to minic IntSummaryStatistics. Orginal idea had been to
> create a BigDecimalAverager just for calculate an average in functional
> style, but after I saw IntSummaryStatistics from JDK i deciced to exdends
> functionality.

I'm wary of dropping this in "Commons Statistics" without a broader view
of the design of a package where it would perhaps fit with similar functionality
for other number types.
Could the class be generic?  If so, what would be the API required to perform
the operations?  "Commons Numbers" has some suggestions[1][2]; those can,
and should, be adapted to actual use-cases, such as "streams" (preferably
before the first release).

It would perhaps be helpful to know why there is no "BigDecimalStatistics" in
the JDK.

Regards,
Gilles

[1] https://gitbox.apache.org/repos/asf?p=commons-numbers.git;a=tree;f=commons-numbers-core/src/main/java/org/apache/commons/numbers/core
[2] https://gitbox.apache.org/repos/asf?p=commons-numbers.git;a=blob;f=commons-numbers-field/src/main/java/org/apache/commons/numbers/field/Field.java

>
> Regards, Aleksander
>
> On Fri, 17 May 2019 at 00:24, Gilles Sadowski <[hidden email]> wrote:
>
> > Hi.
> >
> > Le jeu. 16 mai 2019 à 22:45, Aleksander Ściborek
> > <[hidden email]> a écrit :
> > >
> > > Should I create a new Maven commons-statistics submodule for this?
> >
> > [If the current idea is put the functionality in "Commons Statistics", you
> > should change this thread's "Subject:" line.]
> >
> > Then, yes, there should be a new module.
> >
> > > Besides
> > > the BigDecimalStatistics I'm going to create support for downstream
> > > operators for BigDecimals and maybe BigIntegers.
> >
> > Is the goal to "only" mimic the JDK's "IntSummaryStatistics", or do you
> > have a specific use-case?
> > In the latter case, it will be worth considering how all the functionality
> > in
> > Commons Math's "o.a.c.math4.stat.descriptive" package[1] will be
> > supported.
> >
> > Regards,
> > Gilles
> >
> > [1]
> > https://gitbox.apache.org/repos/asf?p=commons-math.git;a=tree;f=src/main/java/org/apache/commons/math4/stat/descriptive
> >
> >
> >
> > > On Wed, 15 May 2019 at 03:36, Eric Barnhill <[hidden email]>
> > wrote:
> > >
> > > > Yes. This sounds great for commons-statistics. Other work in a similar
> > vein
> > > > will be happening this summer by one of our GSOC mentees.
> > > >
> > > > On Tue, May 14, 2019, 15:04 Gary Gregory <[hidden email]>
> > wrote:
> > > >
> > > > > We have a Commons Statistics component that might be a fit.
> > > > >
> > > > > Gary
> > > > >
> > > > > On Tue, May 14, 2019, 17:34 Aleksander Ściborek <
> > > > > [hidden email]> wrote:
> > > > >
> > > > > > Hi, I've come up with the idea of making easier using Stream with
> > > > > > BigDecimal class.
> > > > > > The idea is to create BigDecimalStatistics class which provide a
> > > > > convenient
> > > > > > way for calculating max, min, average and sum from BigDecimals from
> > > > > Stream.
> > > > > > I think that it's very suitable for commons library.
> > > > > > Should it be implemented in commons lang or commons math? I believe
> > > > that
> > > > > > it's more suitable for commons lang
> > > > > > This is a link to Jira Ticket : LANG-1459
> > > > > > <https://issues.apache.org/jira/browse/LANG-1459>
> > > > > > Aleksander
> > > > > >
> > > > >
> > > >
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Statistics] BigDecimalStatistics proposition

Aleksander Ściborek
Hi, I don't know why there is not such a class in JDK. Maybe because
BigDecimal and BigInteger are objects not primitives therefore they can
have null value.
I believe that that package should contains BigDecimalStatistics,
BigIntegerStatistics and tools for downstreams collectors in order to
performe some downstream operations like averagingInt in JDK.
I've already started implementing BigDecimalStatistics on my fork but I
haven't pushed those changes on my fork


On Fri, 17 May 2019 at 14:19, Gilles Sadowski <[hidden email]> wrote:

> Hello.
>
> Le ven. 17 mai 2019 à 12:14, Aleksander Ściborek
> <[hidden email]> a écrit :
> >
> > Hi,
> > Right now I'm going to minic IntSummaryStatistics. Orginal idea had been
> to
> > create a BigDecimalAverager just for calculate an average in functional
> > style, but after I saw IntSummaryStatistics from JDK i deciced to exdends
> > functionality.
>
> I'm wary of dropping this in "Commons Statistics" without a broader view
> of the design of a package where it would perhaps fit with similar
> functionality
> for other number types.
> Could the class be generic?  If so, what would be the API required to
> perform
> the operations?  "Commons Numbers" has some suggestions[1][2]; those can,
> and should, be adapted to actual use-cases, such as "streams" (preferably
> before the first release).
>
> It would perhaps be helpful to know why there is no "BigDecimalStatistics"
> in
> the JDK.
>
> Regards,
> Gilles
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [Statistics] BigDecimalStatistics proposition

Gilles Sadowski-2
Hello.

Le ven. 17 mai 2019 à 14:40, Aleksander Ściborek
<[hidden email]> a écrit :
>
> Hi, I don't know why there is not such a class in JDK. Maybe because
> BigDecimal and BigInteger are objects not primitives therefore they can
> have null value.

How is the "null" consideration related to the functionality of performing
an average, and other operations?

> I believe that that package

Which "package"?

> should contains BigDecimalStatistics,
> BigIntegerStatistics and tools for downstreams collectors in order to
> performe some downstream operations like averagingInt in JDK.

How will a user get e.g. the variance too?

Regards,
Gilles

> I've already started implementing BigDecimalStatistics on my fork but I
> haven't pushed those changes on my fork
>
>
> On Fri, 17 May 2019 at 14:19, Gilles Sadowski <[hidden email]> wrote:
>
> > Hello.
> >
> > Le ven. 17 mai 2019 à 12:14, Aleksander Ściborek
> > <[hidden email]> a écrit :
> > >
> > > Hi,
> > > Right now I'm going to minic IntSummaryStatistics. Orginal idea had been
> > to
> > > create a BigDecimalAverager just for calculate an average in functional
> > > style, but after I saw IntSummaryStatistics from JDK i deciced to exdends
> > > functionality.
> >
> > I'm wary of dropping this in "Commons Statistics" without a broader view
> > of the design of a package where it would perhaps fit with similar
> > functionality
> > for other number types.
> > Could the class be generic?  If so, what would be the API required to
> > perform
> > the operations?  "Commons Numbers" has some suggestions[1][2]; those can,
> > and should, be adapted to actual use-cases, such as "streams" (preferably
> > before the first release).
> >
> > It would perhaps be helpful to know why there is no "BigDecimalStatistics"
> > in
> > the JDK.
> >
> > Regards,
> > Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Statistics] BigDecimalStatistics proposition

Aleksander Ściborek
Hi,

>How is the "null" consideration related to the functionality of performing
an average, and other operations?

I just don't know why they haven't implement anything like that for
BigDecimal or BigInteger, especially it's for my strange because BigDecimal
is a convenient type for financial calculations.

> Which "package"

I was referring to your words:

"I'm wary of dropping this in "Commons Statistics" without a broader view
of the design of a package where it would perhaps fit with similar
functionality"

>How will a user get e.g. the variance too?

I didn't plan that functionality

Regards
Reply | Threaded
Open this post in threaded view
|

Re: [Statistics] BigDecimalStatistics proposition

Gilles Sadowski-2
Hi.

Le ven. 17 mai 2019 à 15:13, Aleksander Ściborek
<[hidden email]> a écrit :
>
> Hi,
>
> >How is the "null" consideration related to the functionality of performing
> an average, and other operations?
>
> I just don't know why they haven't implement anything like that for
> BigDecimal or BigInteger, especially it's for my strange because BigDecimal
> is a convenient type for financial calculations.

Hence my question: Do you have use-cases? (Your own, or reference
to other libraries that use types similar to "BigDecimal" in the way you
propose to be implemented here.)

>
> > Which "package"
>
> I was referring to your words:
>
> "I'm wary of dropping this in "Commons Statistics" without a broader view
> of the design of a package where it would perhaps fit with similar
> functionality"

Yes, but that "package" does not exist yet; hence we (you) have to
1. suggest a scope for a new maven module,
2. show how your proposed code fit within the rest (even if it's not
implemented yet).

>
> >How will a user get e.g. the variance too?
>
> I didn't plan that functionality

But is it possible, in your plan?

Regards,
Gilles

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Statistics] BigDecimalStatistics proposition

Aleksander Ściborek
Hi

>Hence my question: Do you have use-cases? (Your own, or reference
>to other libraries that use types similar to "BigDecimal" in the way you
>propose to be implemented here.)

My idea is to use that API in similar way:

https://pastebin.com/HGcKwv3V

>Yes, but that "package" does not exist yet; hence we (you) have to
>1. suggest a scope for a new maven module,

My general proposition is to provide some new tools for functional way of
processing data in order to generate some statistics(right now I think
mostly about BigDecimal/BigInteger). The scope for now is not big but I
believe it is quite useful.

Regards

On Fri, 17 May 2019 at 15:37, Gilles Sadowski <[hidden email]> wrote:

> Hi.
>
> Le ven. 17 mai 2019 à 15:13, Aleksander Ściborek
> <[hidden email]> a écrit :
> >
> > Hi,
> >
> > >How is the "null" consideration related to the functionality of
> performing
> > an average, and other operations?
> >
> > I just don't know why they haven't implement anything like that for
> > BigDecimal or BigInteger, especially it's for my strange because
> BigDecimal
> > is a convenient type for financial calculations.
>
> Hence my question: Do you have use-cases? (Your own, or reference
> to other libraries that use types similar to "BigDecimal" in the way you
> propose to be implemented here.)
>
> >
> > > Which "package"
> >
> > I was referring to your words:
> >
> > "I'm wary of dropping this in "Commons Statistics" without a broader view
> > of the design of a package where it would perhaps fit with similar
> > functionality"
>
> Yes, but that "package" does not exist yet; hence we (you) have to
> 1. suggest a scope for a new maven module,
> 2. show how your proposed code fit within the rest (even if it's not
> implemented yet).
>
> >
> > >How will a user get e.g. the variance too?
> >
> > I didn't plan that functionality
>
> But is it possible, in your plan?
>
> Regards,
> Gilles
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: [Statistics] BigDecimalStatistics proposition

Gilles Sadowski-2
Hello.

Le mar. 21 mai 2019 à 00:20, Aleksander Ściborek
<[hidden email]> a écrit :

>
> Hi
>
> >Hence my question: Do you have use-cases? (Your own, or reference
> >to other libraries that use types similar to "BigDecimal" in the way you
> >propose to be implemented here.)
>
> My idea is to use that API in similar way:
>
> https://pastebin.com/HGcKwv3V

This is a usage example.
What I meant is a "real-life" application.

>
> >Yes, but that "package" does not exist yet; hence we (you) have to
> >1. suggest a scope for a new maven module,
>
> My general proposition is to provide some new tools for functional way of
> processing data in order to generate some statistics(right now I think
> mostly about BigDecimal/BigInteger). The scope for now is not big but I
> believe it is quite useful.

This component is a WIP, but there should be some rough roadmap.
The guideline is that at some point, all the functionality in the
  org.apache.commons.math4.stat.descriptive
package (and sub-packages thereof) of "Commons Math" should be
provided by a new
  commons-statistics-descriptive
maven module of "Commons Statistics".

Perhaps that your proposed contribution fits that plan, but it is not
obvious to me.  For example, should there be a dedicated
  commons-statistics-descriptive-bigdecimal
module?  Or will the functionality be provided in a generic way?

IMHO, a worthy principle, to be applied for the new components, is to
avoid that they become a dump of numerous disparate little tools.

Maybe I'm missing what you are getting at.
Hopefully, someone else can comment (Eric?).

Regards,
Gilles

>
> On Fri, 17 May 2019 at 15:37, Gilles Sadowski <[hidden email]> wrote:
>
> > Hi.
> >
> > Le ven. 17 mai 2019 à 15:13, Aleksander Ściborek
> > <[hidden email]> a écrit :
> > >
> > > Hi,
> > >
> > > >How is the "null" consideration related to the functionality of
> > performing
> > > an average, and other operations?
> > >
> > > I just don't know why they haven't implement anything like that for
> > > BigDecimal or BigInteger, especially it's for my strange because
> > BigDecimal
> > > is a convenient type for financial calculations.
> >
> > Hence my question: Do you have use-cases? (Your own, or reference
> > to other libraries that use types similar to "BigDecimal" in the way you
> > propose to be implemented here.)
> >
> > >
> > > > Which "package"
> > >
> > > I was referring to your words:
> > >
> > > "I'm wary of dropping this in "Commons Statistics" without a broader view
> > > of the design of a package where it would perhaps fit with similar
> > > functionality"
> >
> > Yes, but that "package" does not exist yet; hence we (you) have to
> > 1. suggest a scope for a new maven module,
> > 2. show how your proposed code fit within the rest (even if it's not
> > implemented yet).
> >
> > >
> > > >How will a user get e.g. the variance too?
> > >
> > > I didn't plan that functionality
> >
> > But is it possible, in your plan?
> >
> > Regards,
> > Gilles
> >

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]