You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by db...@apache.org on 2016/05/29 21:28:11 UTC

[math] avoid allocating distribution bounds if there are no successes

Repository: commons-math
Updated Branches:
  refs/heads/master 91b2f4294 -> 02dd98a04


avoid allocating distribution bounds if there are no successes


Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
Commit: http://git-wip-us.apache.org/repos/asf/commons-math/commit/02dd98a0
Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/02dd98a0
Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/02dd98a0

Branch: refs/heads/master
Commit: 02dd98a04570a1beba88566281efcabc8ff6f73d
Parents: 91b2f42
Author: Dave Brosius <db...@mebigfatguy.com>
Authored: Sun May 29 17:27:37 2016 -0400
Committer: Dave Brosius <db...@mebigfatguy.com>
Committed: Sun May 29 17:27:37 2016 -0400

----------------------------------------------------------------------
 .../math4/stat/interval/ClopperPearsonInterval.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/commons-math/blob/02dd98a0/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
index bf5d6ad..ed0904c 100644
--- a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
+++ b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
@@ -35,19 +35,19 @@ public class ClopperPearsonInterval implements BinomialConfidenceInterval {
         IntervalUtils.checkParameters(numberOfTrials, numberOfSuccesses, confidenceLevel);
         double lowerBound = 0;
         double upperBound = 0;
-        final double alpha = (1.0 - confidenceLevel) / 2.0;
-
-        final FDistribution distributionLowerBound = new FDistribution(2 * (numberOfTrials - numberOfSuccesses + 1),
-                                                                       2 * numberOfSuccesses);
+ 
         if (numberOfSuccesses > 0) {
+            final double alpha = (1.0 - confidenceLevel) / 2.0;
+
+            final FDistribution distributionLowerBound = new FDistribution(2 * (numberOfTrials - numberOfSuccesses + 1),
+                                                                           2 * numberOfSuccesses);
             final double fValueLowerBound = distributionLowerBound.inverseCumulativeProbability(1 - alpha);
             lowerBound = numberOfSuccesses /
                          (numberOfSuccesses + (numberOfTrials - numberOfSuccesses + 1) * fValueLowerBound);
-        }
 
-        final FDistribution distributionUpperBound = new FDistribution(2 * (numberOfSuccesses + 1),
-                                                                       2 * (numberOfTrials - numberOfSuccesses));
-        if (numberOfSuccesses > 0) {
+
+            final FDistribution distributionUpperBound = new FDistribution(2 * (numberOfSuccesses + 1),
+                                                                           2 * (numberOfTrials - numberOfSuccesses));
             final double fValueUpperBound = distributionUpperBound.inverseCumulativeProbability(1 - alpha);
             upperBound = (numberOfSuccesses + 1) * fValueUpperBound /
                          (numberOfTrials - numberOfSuccesses + (numberOfSuccesses + 1) * fValueUpperBound);


Re: [math] avoid allocating distribution bounds if there are no successes

Posted by James Carman <ja...@carmanconsulting.com>.
Why not create a release prep branch for each release when ready? The
"gitflow" treatment of master is that's what's currently "in production" or
whatever. I don't really care for that model, but it is popular. For
libraries that support multiple versions, I don't know how realistic that
is.

On Wed, Jun 1, 2016 at 6:25 PM sebb <se...@gmail.com> wrote:

> Given that the 'master' branch is normally where development takes
> place, this problem is going to keep recurring.
>
> Maybe MATH should consider using 'master' as the normal development
> branch and 'release' or somesuch for the release candidate.
>
>
> On 29 May 2016 at 22:42, Gilles <gi...@harfang.homelinux.org> wrote:
> > Hi.
> >
> > Thanks for willing to participate, but the "master" branch should be
> > modified only by merging the "develop" into it (before preparing a
> > release).
> > Cf. rationale in "doc/development/development.howto.txt" (in the
> > "develop" branch).
> >
> > Regards,
> > Gilles
> >
> >
> >
> > On Sun, 29 May 2016 21:28:11 +0000 (UTC), dbrosius@apache.org wrote:
> >>
> >> Repository: commons-math
> >> Updated Branches:
> >>   refs/heads/master 91b2f4294 -> 02dd98a04
> >>
> >>
> >> avoid allocating distribution bounds if there are no successes
> >>
> >>
> >> Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
> >> Commit:
> >> http://git-wip-us.apache.org/repos/asf/commons-math/commit/02dd98a0
> >> Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/02dd98a0
> >> Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/02dd98a0
> >>
> >> Branch: refs/heads/master
> >> Commit: 02dd98a04570a1beba88566281efcabc8ff6f73d
> >> Parents: 91b2f42
> >> Author: Dave Brosius <db...@mebigfatguy.com>
> >> Authored: Sun May 29 17:27:37 2016 -0400
> >> Committer: Dave Brosius <db...@mebigfatguy.com>
> >> Committed: Sun May 29 17:27:37 2016 -0400
> >>
> >>
> >> ----------------------------------------------------------------------
> >>  .../math4/stat/interval/ClopperPearsonInterval.java | 16
> ++++++++--------
> >>  1 file changed, 8 insertions(+), 8 deletions(-)
> >>
> >> ----------------------------------------------------------------------
> >>
> >>
> >>
> >>
> >>
> http://git-wip-us.apache.org/repos/asf/commons-math/blob/02dd98a0/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
> >>
> >> ----------------------------------------------------------------------
> >> diff --git
> >>
> >>
> >>
> a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
> >>
> >>
> >>
> b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
> >> index bf5d6ad..ed0904c 100644
> >> ---
> >>
> >>
> >>
> a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
> >> +++
> >>
> >>
> >>
> b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
> >> @@ -35,19 +35,19 @@ public class ClopperPearsonInterval implements
> >> BinomialConfidenceInterval {
> >>          IntervalUtils.checkParameters(numberOfTrials,
> >> numberOfSuccesses, confidenceLevel);
> >>          double lowerBound = 0;
> >>          double upperBound = 0;
> >> -        final double alpha = (1.0 - confidenceLevel) / 2.0;
> >> -
> >> -        final FDistribution distributionLowerBound = new
> >> FDistribution(2 * (numberOfTrials - numberOfSuccesses + 1),
> >> -
> >>  2 * numberOfSuccesses);
> >> +
> >>          if (numberOfSuccesses > 0) {
> >> +            final double alpha = (1.0 - confidenceLevel) / 2.0;
> >> +
> >> +            final FDistribution distributionLowerBound = new
> >> FDistribution(2 * (numberOfTrials - numberOfSuccesses + 1),
> >> +
> >>      2 * numberOfSuccesses);
> >>              final double fValueLowerBound =
> >> distributionLowerBound.inverseCumulativeProbability(1 - alpha);
> >>              lowerBound = numberOfSuccesses /
> >>                           (numberOfSuccesses + (numberOfTrials -
> >> numberOfSuccesses + 1) * fValueLowerBound);
> >> -        }
> >>
> >> -        final FDistribution distributionUpperBound = new
> >> FDistribution(2 * (numberOfSuccesses + 1),
> >> -
> >>  2 * (numberOfTrials - numberOfSuccesses));
> >> -        if (numberOfSuccesses > 0) {
> >> +
> >> +            final FDistribution distributionUpperBound = new
> >> FDistribution(2 * (numberOfSuccesses + 1),
> >> +
> >>      2 * (numberOfTrials - numberOfSuccesses));
> >>              final double fValueUpperBound =
> >> distributionUpperBound.inverseCumulativeProbability(1 - alpha);
> >>              upperBound = (numberOfSuccesses + 1) * fValueUpperBound /
> >>                           (numberOfTrials - numberOfSuccesses +
> >> (numberOfSuccesses + 1) * fValueUpperBound);
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> > For additional commands, e-mail: dev-help@commons.apache.org
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Re: [math] avoid allocating distribution bounds if there are no successes

Posted by sebb <se...@gmail.com>.
Given that the 'master' branch is normally where development takes
place, this problem is going to keep recurring.

Maybe MATH should consider using 'master' as the normal development
branch and 'release' or somesuch for the release candidate.


On 29 May 2016 at 22:42, Gilles <gi...@harfang.homelinux.org> wrote:
> Hi.
>
> Thanks for willing to participate, but the "master" branch should be
> modified only by merging the "develop" into it (before preparing a
> release).
> Cf. rationale in "doc/development/development.howto.txt" (in the
> "develop" branch).
>
> Regards,
> Gilles
>
>
>
> On Sun, 29 May 2016 21:28:11 +0000 (UTC), dbrosius@apache.org wrote:
>>
>> Repository: commons-math
>> Updated Branches:
>>   refs/heads/master 91b2f4294 -> 02dd98a04
>>
>>
>> avoid allocating distribution bounds if there are no successes
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
>> Commit:
>> http://git-wip-us.apache.org/repos/asf/commons-math/commit/02dd98a0
>> Tree: http://git-wip-us.apache.org/repos/asf/commons-math/tree/02dd98a0
>> Diff: http://git-wip-us.apache.org/repos/asf/commons-math/diff/02dd98a0
>>
>> Branch: refs/heads/master
>> Commit: 02dd98a04570a1beba88566281efcabc8ff6f73d
>> Parents: 91b2f42
>> Author: Dave Brosius <db...@mebigfatguy.com>
>> Authored: Sun May 29 17:27:37 2016 -0400
>> Committer: Dave Brosius <db...@mebigfatguy.com>
>> Committed: Sun May 29 17:27:37 2016 -0400
>>
>>
>> ----------------------------------------------------------------------
>>  .../math4/stat/interval/ClopperPearsonInterval.java | 16 ++++++++--------
>>  1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> ----------------------------------------------------------------------
>>
>>
>>
>>
>> http://git-wip-us.apache.org/repos/asf/commons-math/blob/02dd98a0/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
>>
>> ----------------------------------------------------------------------
>> diff --git
>>
>>
>> a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
>>
>>
>> b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
>> index bf5d6ad..ed0904c 100644
>> ---
>>
>>
>> a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
>> +++
>>
>>
>> b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
>> @@ -35,19 +35,19 @@ public class ClopperPearsonInterval implements
>> BinomialConfidenceInterval {
>>          IntervalUtils.checkParameters(numberOfTrials,
>> numberOfSuccesses, confidenceLevel);
>>          double lowerBound = 0;
>>          double upperBound = 0;
>> -        final double alpha = (1.0 - confidenceLevel) / 2.0;
>> -
>> -        final FDistribution distributionLowerBound = new
>> FDistribution(2 * (numberOfTrials - numberOfSuccesses + 1),
>> -
>>  2 * numberOfSuccesses);
>> +
>>          if (numberOfSuccesses > 0) {
>> +            final double alpha = (1.0 - confidenceLevel) / 2.0;
>> +
>> +            final FDistribution distributionLowerBound = new
>> FDistribution(2 * (numberOfTrials - numberOfSuccesses + 1),
>> +
>>      2 * numberOfSuccesses);
>>              final double fValueLowerBound =
>> distributionLowerBound.inverseCumulativeProbability(1 - alpha);
>>              lowerBound = numberOfSuccesses /
>>                           (numberOfSuccesses + (numberOfTrials -
>> numberOfSuccesses + 1) * fValueLowerBound);
>> -        }
>>
>> -        final FDistribution distributionUpperBound = new
>> FDistribution(2 * (numberOfSuccesses + 1),
>> -
>>  2 * (numberOfTrials - numberOfSuccesses));
>> -        if (numberOfSuccesses > 0) {
>> +
>> +            final FDistribution distributionUpperBound = new
>> FDistribution(2 * (numberOfSuccesses + 1),
>> +
>>      2 * (numberOfTrials - numberOfSuccesses));
>>              final double fValueUpperBound =
>> distributionUpperBound.inverseCumulativeProbability(1 - alpha);
>>              upperBound = (numberOfSuccesses + 1) * fValueUpperBound /
>>                           (numberOfTrials - numberOfSuccesses +
>> (numberOfSuccesses + 1) * fValueUpperBound);
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [math] avoid allocating distribution bounds if there are no successes

Posted by Gilles <gi...@harfang.homelinux.org>.
Hi.

Thanks for willing to participate, but the "master" branch should be
modified only by merging the "develop" into it (before preparing a
release).
Cf. rationale in "doc/development/development.howto.txt" (in the
"develop" branch).

Regards,
Gilles


On Sun, 29 May 2016 21:28:11 +0000 (UTC), dbrosius@apache.org wrote:
> Repository: commons-math
> Updated Branches:
>   refs/heads/master 91b2f4294 -> 02dd98a04
>
>
> avoid allocating distribution bounds if there are no successes
>
>
> Project: http://git-wip-us.apache.org/repos/asf/commons-math/repo
> Commit: 
> http://git-wip-us.apache.org/repos/asf/commons-math/commit/02dd98a0
> Tree: 
> http://git-wip-us.apache.org/repos/asf/commons-math/tree/02dd98a0
> Diff: 
> http://git-wip-us.apache.org/repos/asf/commons-math/diff/02dd98a0
>
> Branch: refs/heads/master
> Commit: 02dd98a04570a1beba88566281efcabc8ff6f73d
> Parents: 91b2f42
> Author: Dave Brosius <db...@mebigfatguy.com>
> Authored: Sun May 29 17:27:37 2016 -0400
> Committer: Dave Brosius <db...@mebigfatguy.com>
> Committed: Sun May 29 17:27:37 2016 -0400
>
> 
> ----------------------------------------------------------------------
>  .../math4/stat/interval/ClopperPearsonInterval.java | 16 
> ++++++++--------
>  1 file changed, 8 insertions(+), 8 deletions(-)
> 
> ----------------------------------------------------------------------
>
>
> 
> http://git-wip-us.apache.org/repos/asf/commons-math/blob/02dd98a0/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
> 
> ----------------------------------------------------------------------
> diff --git
> 
> a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
> 
> b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
> index bf5d6ad..ed0904c 100644
> ---
> 
> a/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
> +++
> 
> b/src/main/java/org/apache/commons/math4/stat/interval/ClopperPearsonInterval.java
> @@ -35,19 +35,19 @@ public class ClopperPearsonInterval implements
> BinomialConfidenceInterval {
>          IntervalUtils.checkParameters(numberOfTrials,
> numberOfSuccesses, confidenceLevel);
>          double lowerBound = 0;
>          double upperBound = 0;
> -        final double alpha = (1.0 - confidenceLevel) / 2.0;
> -
> -        final FDistribution distributionLowerBound = new
> FDistribution(2 * (numberOfTrials - numberOfSuccesses + 1),
> -
>  2 * numberOfSuccesses);
> +
>          if (numberOfSuccesses > 0) {
> +            final double alpha = (1.0 - confidenceLevel) / 2.0;
> +
> +            final FDistribution distributionLowerBound = new
> FDistribution(2 * (numberOfTrials - numberOfSuccesses + 1),
> +
>      2 * numberOfSuccesses);
>              final double fValueLowerBound =
> distributionLowerBound.inverseCumulativeProbability(1 - alpha);
>              lowerBound = numberOfSuccesses /
>                           (numberOfSuccesses + (numberOfTrials -
> numberOfSuccesses + 1) * fValueLowerBound);
> -        }
>
> -        final FDistribution distributionUpperBound = new
> FDistribution(2 * (numberOfSuccesses + 1),
> -
>  2 * (numberOfTrials - numberOfSuccesses));
> -        if (numberOfSuccesses > 0) {
> +
> +            final FDistribution distributionUpperBound = new
> FDistribution(2 * (numberOfSuccesses + 1),
> +
>      2 * (numberOfTrials - numberOfSuccesses));
>              final double fValueUpperBound =
> distributionUpperBound.inverseCumulativeProbability(1 - alpha);
>              upperBound = (numberOfSuccesses + 1) * fValueUpperBound 
> /
>                           (numberOfTrials - numberOfSuccesses +
> (numberOfSuccesses + 1) * fValueUpperBound);


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org