commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ori ziv <zivo...@gmail.com>
Subject Re: [math] basic utilities for probability - isProbability(double) and isSampleSpace(double[])
Date Mon, 16 Jul 2012 23:04:43 GMT
* I updated the files (at
http://dl.dropbox.com/u/4481581/commons-math-suggestions.zip)
* I added the checkProbability method . Do you think that the
isProbability should not be public?
* I added an exception with a customized message.
* I didn't spot yet a place in CM that could use this is/check sample
space function. I thought it could be useful for any method the gets
probabilities which supposed to be a sample space. Don't you think
this case is common?
For example, in another class, InfoTheoryUtils, I've made a method
that calculates the mutual information and one of it arguments is
supposed to be a sample space.
* Any other remarks?
* Am I on the right track?

On Mon, Jul 16, 2012 at 2:36 AM, ori ziv <zivori2@gmail.com> wrote:
> Alright. I'll update soon. Meanwhile the drafts are in
> http://dl.dropbox.com/u/4481581/commons-math-suggestions.zip
>
> On Mon, Jul 16, 2012 at 1:12 AM, Gilles Sadowski
> <gilles@harfang.homelinux.org> wrote:
>> On Sun, Jul 15, 2012 at 02:36:56PM +0300, ori ziv wrote:
>>> Hi,
>>>
>>> I've wrote two basic but useful utilities for probability and tests
>>> for them. I would like to ask if the developers of the Apache Commons
>>> Math project are interested in me submitting them. I still have some
>>> touching up to do so that they fit the style guidelines.
>>>
>>> The first is isProbability(double)
>>> which returns true if and only if x is a probability, i.e., not
>>> smaller than zero and not bigger than one.
>>
>> I'd see something like that as useful within CM if it can replace this
>> kind of code
>> ---
>>   if (p < 0 || p > 1) {
>>     throw new OutOfRangeException(p, 0, 1);
>>   }
>> ---
>>
>> There are examples in "MathUtils" (e.g. "checkFinite").
>> I.e. it should come with an exception that inherits from
>> "OutOfRangeException" with a customized error message.
>>
>>> The other is isSampleSpace(double[]) which returns true if and only if
>>> the values are a sample space, i.e., each value is a probability and
>>> the sum of the values in the input array is one.
>>
>> Did you spot places in CM where this could be used?
>>
>>>
>>> Prototype is attached.
>>
>> I think that attachements are stripped by the ML manager. :-/
>>
>>
>> Regards,
>> Gilles
>>
>> ---------------------------------------------------------------------
>> 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


Mime
View raw message