You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Andre Panisson (JIRA)" <ji...@apache.org> on 2008/09/09 21:27:44 UTC

[jira] Created: (MATH-224) Utility method to aggregate Statistics

Utility method to aggregate Statistics
--------------------------------------

                 Key: MATH-224
                 URL: https://issues.apache.org/jira/browse/MATH-224
             Project: Commons Math
          Issue Type: Improvement
            Reporter: Andre Panisson
            Priority: Minor


Below is the conversation related to this topic that was posted to the Commons Users group.

-------------------------------------------------

Hi,

>
> I'm writing a complex validation algorithm, that makes a K-Fold
> cross-validation using a data set. The data set is partitioned into K
>  subsamples, and of the K subsamples, a single subsample is retained
> as the validation data for testing, and the remaining K − 1
> subsamples are used as training data. The process is then repeated K
> times, and at the end the K results are aggregated to a single
> result. The problem is that all K results return Statistics objects
> (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> need to make the aggregation of all K objects in a single Statistics.
>  I think it is a common problem in the statistics field. There's
> anyone who had already implemented an utility method to do it?

There is no such feature currently in commons-math. The
SummaryStatistics class wraps a bunch of specialized statistics classes
(Sum, Mean, Max, SumOfSquares ...) which can be overriden by
user-provided StorelessUnivariateStatistic implementations.

So this feature should be added to the StorelessUnivariateStatistic
interface and all its implementations, with a signature like this:
 public void aggregate(StorelessUnivariateStatistic otherStatistic);

The implementation of this method should only use the
StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
seems feasible for the statistics used by SummaryStatistics, but has not
been done yet.

One should be aware that SummaryStatistics does not enforce strong
typing, so one could call aggregate on a Sum instance and provide it a
Min instance, which would of course result in meaningless results.

> Or maybe it would be interesting to request it as an Improvement to
> the Commons Math developers, adding an "aggregator" to all Statistics
>  implementations?

If you want to request this improvement, please open a ticket for it
using our JIRA tracking system:
http://issues.apache.org/jira/browse/MATH. You'll have to register to be
able to add your feature request. You can also provide a patch if you
want to contribute it by yourself.

Luc

>
> Thanks in advance,
>
> Andre Panisson


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Reopened: (MATH-224) Utility method to aggregate Statistics

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz reopened MATH-224:
------------------------------


> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-224) Utility method to aggregate Statistics

Posted by "Andre Panisson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12701102#action_12701102 ] 

Andre Panisson commented on MATH-224:
-------------------------------------

After a more detailed review, I have a concern about this approach: the resulting Statistics objects are not thread safe, and even less distributable. For example, in a 10-fold cross-validation, I cannot run the validations in different threads, and also I cannot run in different peers and join the results after computing. Is this a great problem from your point of view?

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch, math_224-descriptive.patch, math_224.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MATH-224) Utility method to aggregate Statistics

Posted by "John Bollinger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Bollinger updated MATH-224:
--------------------------------

    Attachment: math_224-descriptive.patch

Attached a supplemental patch providing the same kind of aggregate statistics class for DescriptiveStatistics as the previous one does for SummaryStatistics.  The two patches are independent.

Whereas I consider the aggregate summary statistics class to be a complete expression of my concept there, I think there are a few open questions with respect to the aggregate descriptive statistics.  The most notable ones I can think of at the moment concern what should happen to an aggregate statistics object when methods are invoked on an associated contributing statistics that changes or removes values already broadcast to the aggregate (removeMostRecentValue(), replaceMostRecentValue(), clear()).  As currently implemented, those methods do not affect the aggregate.

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch, math_224-descriptive.patch, math_224.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MATH-224) Utility method to aggregate Statistics

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz updated MATH-224:
-----------------------------

    Fix Version/s: 2.0
         Assignee: Phil Steitz

Patch looks good, modulo higher moments issue.  

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (MATH-224) Utility method to aggregate Statistics

Posted by "Luc Maisonobe (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Luc Maisonobe closed MATH-224.
------------------------------


closing resolved issue for 2.0 release

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch, math_224-descriptive.patch, math_224.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-224) Utility method to aggregate Statistics

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703059#action_12703059 ] 

Phil Steitz commented on MATH-224:
----------------------------------

First patch committed in r768921.  Thanks!

Andre - good point on thread safety and distribution.  I think a threadsafe version (SynchronizedAggregateSummaryStatistics) could be created by synchronizing the callbacks.  Distributed threads would have to start with a reference to the aggregator, though.  Is that acceptable?

Holding off for now on the second patch.  I am not sure there is a really safe and complete way to handle the problems mentioned above.

Still need to update the user guide for this.



> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch, math_224-descriptive.patch, math_224.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-224) Utility method to aggregate Statistics

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12651755#action_12651755 ] 

Phil Steitz commented on MATH-224:
----------------------------------

After looking carefully at the patch and the higher moments problem, I am now leaning toward WONTFIX for this.  The problem is that the "storeless" statistics are only required to store enough data to support updates via single value increments.  Adding the requirement to support aggregation in the sense defined here places an unacceptable limitation on the implementing classes.  The second moment and variance, for example, only work now because the default implementations carry along nested first moments.  This setup is a little awkward and might be changed; but then it would not be obvious how to support aggregation.  It is not obvious to me how to support this for fourth moments at all.  In any case, I think it is too restrictive a requirement to place on implementations, so if we do support this, it should be via a subclass of SummaryStatistics.

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-224) Utility method to aggregate Statistics

Posted by "Andre Panisson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12652335#action_12652335 ] 

Andre Panisson commented on MATH-224:
-------------------------------------

I didn't understood why the implementation of aggregation would not be obvious changing the implementation setup. I think one premise for the implementation of a storeless second moment and variance is the previous knowledge of the mean, n and previous variance. Without this information, I think it is not possible make an update via single value increment. And the formula I used to aggregate two variances uses this information, the mean, n and variance of each statistic. I'm not a mathematician, but I suppose that in the higher moments, the information needed to update via single value increment is sufficient to calculate also the statistics aggregation.
The implementation I used now is using the nested first moments only because the required information is available in the nested objects. But to support single value increment, the mean, n and variance must be carried in some place, be it a nested object or not, and this is sufficient information also to calculate aggregation.

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (MATH-224) Utility method to aggregate Statistics

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz closed MATH-224.
----------------------------

    Resolution: Won't Fix

Sorry to have to resolve this way, as I think the idea has merit.  Per comments above, however,  it just won't work as a modification to SummaryStatistics (at least I can't see any way to do it).  One way to achieve this in a subclass of SummaryStatistics would be to add aggregate(.) as in the patch to the subclass, replacing the impls with similarly subclassed implementation classes (with aggregate methods added as in the patch) and overriding the implementation setters with methods that just throw UnsupportedOperationException.   

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-224) Utility method to aggregate Statistics

Posted by "John Bollinger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700638#action_12700638 ] 

John Bollinger commented on MATH-224:
-------------------------------------

For clarity, "the approach described on the dev mailing list" is to accumulate aggregate stats simultaneously with accumulating per-partition stats.  The new class supports doing so with very little extra work.

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch, math_224.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-224) Utility method to aggregate Statistics

Posted by "Andre Panisson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12653251#action_12653251 ] 

Andre Panisson commented on MATH-224:
-------------------------------------

I agree that this approach is adding too much complexity to the interface, that should be as simple as possible. But could you give some clues about how to resolve it in another way? You told that it should be via a subclass of SummaryStatistics, but I'm wondering how to implement it, as I would like to have it implemented at least in my application, and at the same time I would like to be in line with the last commons-math release.

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-224) Utility method to aggregate Statistics

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12653113#action_12653113 ] 

Phil Steitz commented on MATH-224:
----------------------------------

The problem is that the requirement to support aggregate() for *all* StorelessUnivariateStatistics is too much.  Even some of the currently defined ones do not support it.  Therefore, it should not be added to the interface. 

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (MATH-224) Utility method to aggregate Statistics

Posted by "John Bollinger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700638#action_12700638 ] 

John Bollinger edited comment on MATH-224 at 4/19/09 7:29 PM:
--------------------------------------------------------------

For clarity, "the approach described on the dev mailing list" is to accumulate aggregate stats simultaneously with accumulating per-partition stats, instead of aggregating after the fact.  The new class supports doing so with very little extra work.

      was (Author: jcbollinger):
    For clarity, "the approach described on the dev mailing list" is to accumulate aggregate stats simultaneously with accumulating per-partition stats.  The new class supports doing so with very little extra work.
  
> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch, math_224.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MATH-224) Utility method to aggregate Statistics

Posted by "Andre Panisson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12700735#action_12700735 ] 

Andre Panisson commented on MATH-224:
-------------------------------------

To the initial problem presented in this issue, this alternative approach seems adequate.

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch, math_224.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (MATH-224) Utility method to aggregate Statistics

Posted by "Phil Steitz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Phil Steitz resolved MATH-224.
------------------------------

    Resolution: Fixed

User guide updated in r794492

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch, math_224-descriptive.patch, math_224.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MATH-224) Utility method to aggregate Statistics

Posted by "Andre Panisson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andre Panisson updated MATH-224:
--------------------------------

    Attachment: commons_math.patch

The patch I'm using as a solution to my problem. Had not implemented aggregation to ThirdMoment and FourthMoment, as my skills in statistics don't go so far...

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Priority: Minor
>         Attachments: commons_math.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (MATH-224) Utility method to aggregate Statistics

Posted by "John Bollinger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/MATH-224?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John Bollinger updated MATH-224:
--------------------------------

    Attachment: math_224.patch

Attached an alternative patch comprising a variant of the approach described on the dev mailing list.  There is one new class -- complete if this approach is accepted -- plus a minimal test case for it.  More thorough tests would be warranted (and I am willing to write them) if the approach is good.

> Utility method to aggregate Statistics
> --------------------------------------
>
>                 Key: MATH-224
>                 URL: https://issues.apache.org/jira/browse/MATH-224
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: Andre Panisson
>            Assignee: Phil Steitz
>            Priority: Minor
>             Fix For: 2.0
>
>         Attachments: commons_math.patch, math_224.patch
>
>
> Below is the conversation related to this topic that was posted to the Commons Users group.
> -------------------------------------------------
> Hi,
> >
> > I'm writing a complex validation algorithm, that makes a K-Fold
> > cross-validation using a data set. The data set is partitioned into K
> >  subsamples, and of the K subsamples, a single subsample is retained
> > as the validation data for testing, and the remaining K − 1
> > subsamples are used as training data. The process is then repeated K
> > times, and at the end the K results are aggregated to a single
> > result. The problem is that all K results return Statistics objects
> > (org.apache.commons.math.stat.descriptive.SummaryStatistics), and I
> > need to make the aggregation of all K objects in a single Statistics.
> >  I think it is a common problem in the statistics field. There's
> > anyone who had already implemented an utility method to do it?
> There is no such feature currently in commons-math. The
> SummaryStatistics class wraps a bunch of specialized statistics classes
> (Sum, Mean, Max, SumOfSquares ...) which can be overriden by
> user-provided StorelessUnivariateStatistic implementations.
> So this feature should be added to the StorelessUnivariateStatistic
> interface and all its implementations, with a signature like this:
>  public void aggregate(StorelessUnivariateStatistic otherStatistic);
> The implementation of this method should only use the
> StorelessUnivariateStatistic methods, i.e. getResult() and getN(). This
> seems feasible for the statistics used by SummaryStatistics, but has not
> been done yet.
> One should be aware that SummaryStatistics does not enforce strong
> typing, so one could call aggregate on a Sum instance and provide it a
> Min instance, which would of course result in meaningless results.
> > Or maybe it would be interesting to request it as an Improvement to
> > the Commons Math developers, adding an "aggregator" to all Statistics
> >  implementations?
> If you want to request this improvement, please open a ticket for it
> using our JIRA tracking system:
> http://issues.apache.org/jira/browse/MATH. You'll have to register to be
> able to add your feature request. You can also provide a patch if you
> want to contribute it by yourself.
> Luc
> >
> > Thanks in advance,
> >
> > Andre Panisson

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.