You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Phil Steitz <ph...@gmail.com> on 2011/10/23 23:15:38 UTC
[math] Distributions over sample spaces other than R
Comments on [math-692] have made me curious about how might we run
into discrete distributions that do not extend
AbstractIntegerDistribution in practical applications. Does anyone
have the need for this? One reason that I am asking about this is
that I have always felt a little funny about basically forcing
sample spaces of probability spaces to be subsets of R by the setup
we have. The way we are forced to remap values in
IntegerDistribution is a little smelly and to actually compute
anything for discrete distributions in the current setup, their
sample spaces have to be mapped to some subset of the integers. I
like the setup for classical continuous distributions over R and can
live with it for discrete distributions over Z, which is all that we
have ever implemented. To model the more general case, we would
have to parameterize the type of the sample space. This may make
sense and have value in the discrete case; but if done at the top of
the hierarchy it would complicate things for the currently
implemented distributions and force use of Double everywhere in
place of double. If the only practical use case we can identify is
discrete distributions over non-Integer domains, we could just
create some kind of adapter. Any thoughts on this?
Phil
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [math] Distributions over sample spaces other than R
Posted by Ted Dunning <te...@gmail.com>.
On Mon, Oct 31, 2011 at 2:56 PM, cwinter <ch...@aol.com> wrote:
>
> Phil Steitz wrote:
> >
> > Maybe it would be best to eliminate IntegerDistribution then and
> > merge Distribution and ContinuousDistribution, so we have two roots
> > - DiscreteDistribution and ContinuousDistribution. The only reason
> > really to have DiscreteDistribution is if we want to support
> > distributions of RVs over sample spaces that are not subsets of Z.
> > There does not seem to be much enthusiasm for that (i.e.
> > parameterizing the type of the domain of the distribution and pmf),
> > so we might as well just collapse Discrete and Integer. Once you
> > pull out Discrete/Integer, there is not much value any more in
> > Distribution as a parent, so why not just drop both
> > IntegerDistribution and Distribution and move to two roots with
> > doubles / ints as domains and contracts cleaned up to deal with
> > discrete vs continuous cases consistently.
> >
> > Phil
> >
>
> I'm absolutely convinced that the approach with two roots suits our needs.
> However, for real-valued random variables we need a hierarchy of
> distribution interfaces because not every distribution on the reals has a
> density.
Lordy... this is really more complicated than necessary.
You could just have a single interface/abstract class and have
distributions throw UOE if they can't do something like give you a density.
At most, a marker interface or hasDensity() indicator method is needed.
Commons projects and commons math really have a tendency to over-engineer
the type structure instead of just going and implementing some useful
functions.
> Thus I'd like to keep Distribution and ContinuousDistribution. But
> maybe we could change the names to put more emphasis on the domain of
> the distribution, e.g. to RealDistribution and ContinuousRealDistribution.
>
Do you have any code for which this distinction would actually matter more
than a hairs-breadth?
> ... Apart from this, a separate interface for more general discrete
> distributions is indeed not required.
>
I should bless you for saying this at least.
Re: [math] Distributions over sample spaces other than R
Posted by cwinter <ch...@aol.com>.
Phil Steitz wrote:
>
> Maybe it would be best to eliminate IntegerDistribution then and
> merge Distribution and ContinuousDistribution, so we have two roots
> - DiscreteDistribution and ContinuousDistribution. The only reason
> really to have DiscreteDistribution is if we want to support
> distributions of RVs over sample spaces that are not subsets of Z.
> There does not seem to be much enthusiasm for that (i.e.
> parameterizing the type of the domain of the distribution and pmf),
> so we might as well just collapse Discrete and Integer. Once you
> pull out Discrete/Integer, there is not much value any more in
> Distribution as a parent, so why not just drop both
> IntegerDistribution and Distribution and move to two roots with
> doubles / ints as domains and contracts cleaned up to deal with
> discrete vs continuous cases consistently.
>
> Phil
>
I'm absolutely convinced that the approach with two roots suits our needs.
However, for real-valued random variables we need a hierarchy of
distribution interfaces because not every distribution on the reals has a
density. Thus I'd like to keep Distribution and ContinuousDistribution. But
maybe we could change the names to put more emphasis on the domain of the
distribution, e.g. to RealDistribution and ContinuousRealDistribution.
Similarly, I prefer IntegerDistribution as name for the other root because
DiscreteDistribution doesn't reveal the domain of the distribution. Apart
from this, a separate interface for more general discrete distributions is
indeed not required.
Christian
--
View this message in context: http://apache-commons.680414.n4.nabble.com/math-Distributions-over-sample-spaces-other-than-R-tp3931349p3961807.html
Sent from the Commons - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [math] Distributions over sample spaces other than R
Posted by Sébastien Brisard <se...@m4x.org>.
>
> What exactly do we gain by having the common parent? The inverse
> cdf machinery will work only for the continuous (by that, I mean
> real-valued RV) case. Note how it is overriden now in
> AbstractIntegerDistribution. So why not just leave that alone and
> separate out the discrete/integer/whatever-we-want-to-call-it case?
> Discrete distributions are fundamentally different. They have
> pmfs. They have discrete value sets. Inversion works differently.
> Inequalities work differently. Why not just cleanly separate?
>
> Phil
>
I agree with Phil: do we have a use-case where this common parent
would be required?
This common parent would be very satisfactory on the theoretical side,
but in my view, in order to be really beneficial, it would have to
provide a unified way to access to the *probability measure*. So, in
order to accomodate both discrete and continuous cases, this would
require to implement the pdf/pmf as a measure. Instead of
density(double x), we would have to provide a method
integrate(UnivariateRealFunction f) which would return the integral of
f against the probability measure. While doable, and beautiful from
the mathematical point of view, I'm wondering about the
usefulness/efficiency.
Sébastien
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [math] Distributions over sample spaces other than R
Posted by Phil Steitz <ph...@gmail.com>.
On 11/5/11 12:11 PM, cwinter wrote:
> Hi,
>
> I'm picking up the discussion on the interface structure for distributions
> again.
>
> Now there is consensus on having separate roots for each domain: one for
> real-valued distributions and one for integer distributions.
>
> After thinking once more about distributions with densities vs. those
> without, I agree that two interfaces for the real domain are not necessary,
> and we should go for simplicity. For distributions not having a density, the
> implementation of density(double) could provide results being as meaningful
> as possible. It could return infinity (where the distribution has "discrete
> points" - as proposed by Sébastien on another thread
> http://apache-commons.680414.n4.nabble.com/math-Continuous-Distribution-tp3950057p3950057.html)
> or something else seeming to be appropriate (where there is another reason
> for the actual density not to exist).
+1 - just need to document clearly what is going on if and when we
implement such things.
>
> The naming issue is still open. In my opion, a name containing the name of
> the distribution's domain (instead of a property) helps to avoid ambiguity
> and funny curiosities (A random sample of a normal distribution is
> associated with a *discrete* empirical distribution which approximately
> renders the according normal distribution. However, the sample's
> distribution would implement the interface for the real domain. Thus the
> interface for the integer domain should not have the name
> DiscreteDistribution.). Additionally, it would be easier to provide more
> roots if users require support for further domains (e.g. if a multidimension
> normal distribution shall be implemented).
I was resisting this before, wanting to stay with the conventional
continuous/discrete naming; but you have convinced me
"IntegerDistribution" is better for the discrete case. I guess the
logical name to use for the continuous case is "RealDistribution."
That leaves open "MultivariateXxDistribution" which we could add later.
Assuming there are no objections to this approach, it would be great
if you could create a JIRA for this and attach a patch taking a stab
at it.
Phil
>
> Christian
>
> --
> View this message in context: http://apache-commons.680414.n4.nabble.com/math-Distributions-over-sample-spaces-other-than-R-tp3931349p3994066.html
> Sent from the Commons - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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] Distributions over sample spaces other than R
Posted by cwinter <ch...@aol.com>.
Hi,
I'm picking up the discussion on the interface structure for distributions
again.
Now there is consensus on having separate roots for each domain: one for
real-valued distributions and one for integer distributions.
After thinking once more about distributions with densities vs. those
without, I agree that two interfaces for the real domain are not necessary,
and we should go for simplicity. For distributions not having a density, the
implementation of density(double) could provide results being as meaningful
as possible. It could return infinity (where the distribution has "discrete
points" - as proposed by Sébastien on another thread
http://apache-commons.680414.n4.nabble.com/math-Continuous-Distribution-tp3950057p3950057.html)
or something else seeming to be appropriate (where there is another reason
for the actual density not to exist).
The naming issue is still open. In my opion, a name containing the name of
the distribution's domain (instead of a property) helps to avoid ambiguity
and funny curiosities (A random sample of a normal distribution is
associated with a *discrete* empirical distribution which approximately
renders the according normal distribution. However, the sample's
distribution would implement the interface for the real domain. Thus the
interface for the integer domain should not have the name
DiscreteDistribution.). Additionally, it would be easier to provide more
roots if users require support for further domains (e.g. if a multidimension
normal distribution shall be implemented).
Christian
--
View this message in context: http://apache-commons.680414.n4.nabble.com/math-Distributions-over-sample-spaces-other-than-R-tp3931349p3994066.html
Sent from the Commons - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [math] Distributions over sample spaces other than R
Posted by Mikkel Meyer Andersen <mi...@mikl.dk>.
I see your point, Phil, and agree with you. Thanks for clarifying.
Cheers, Mikkel.
Den 01/11/2011 18.24 skrev "Phil Steitz" <ph...@gmail.com>:
> On 11/1/11 1:05 AM, Mikkel Meyer Andersen wrote:
> > 2011/10/30 Phil Steitz <ph...@gmail.com>:
> >> On 10/29/11 10:20 AM, cwinter wrote:
> >>> Phil Steitz wrote:
> >>>> I would say pull DiscreteDistribution out. That is where the
> >>>> difference really lies. I have thought about suggesting that we
> >>>> eliminate it altogether; but I still think there may be value in
> >>>> supporting discrete distributions over sample spaces that are not
> >>>> embedded in the integers.
> >>>>
> >>>> Phil
> >>>>
> >>> Empirical distributions are discrete by nature. Depending on the
> underlying
> >>> data, the domain is usually (a subset of) the reals or the integers.
> >>> However, after moving probability(double) to Distribution,
> >>> DiscreteDistribution will be an empty interface. Thus there is in fact
> the
> >>> question whether it should be eliminated. Otherwise it would be just a
> >>> "flag" for discrete distributions and that's indeed independent of the
> >>> sample space.
> >> Maybe it would be best to eliminate IntegerDistribution then and
> >> merge Distribution and ContinuousDistribution, so we have two roots
> >> - DiscreteDistribution and ContinuousDistribution. The only reason
> >> really to have DiscreteDistribution is if we want to support
> >> distributions of RVs over sample spaces that are not subsets of Z.
> >> There does not seem to be much enthusiasm for that (i.e.
> >> parameterizing the type of the domain of the distribution and pmf),
> >> so we might as well just collapse Discrete and Integer. Once you
> >> pull out Discrete/Integer, there is not much value any more in
> >> Distribution as a parent, so why not just drop both
> >> IntegerDistribution and Distribution and move to two roots with
> >> doubles / ints as domains and contracts cleaned up to deal with
> >> discrete vs continuous cases consistently.
> > If we have these two roots, I would propose an Distribution interface
> > with e.g. with cdf and inverse cdf. Alternatively, an abstract class
> > implementing a default solver for the inverse cdf. We might be able to
> > make this generic parameterising the argument to cdf and others.
>
> The only way for this to work is to parameterize the type of the
> sample space, which will then force Double to be used for the
> continuous case. Why is it so bad to have two roots?
>
> What exactly do we gain by having the common parent? The inverse
> cdf machinery will work only for the continuous (by that, I mean
> real-valued RV) case. Note how it is overriden now in
> AbstractIntegerDistribution. So why not just leave that alone and
> separate out the discrete/integer/whatever-we-want-to-call-it case?
> Discrete distributions are fundamentally different. They have
> pmfs. They have discrete value sets. Inversion works differently.
> Inequalities work differently. Why not just cleanly separate?
>
> Phil
> >
> > In my opinion, we benefit from having one such common ancestor instead
> > of two "independent" linages.
> >
> >> Phil
> >>> Christian
> >>>
> >>> --
> >>> View this message in context:
> http://apache-commons.680414.n4.nabble.com/math-Distributions-over-sample-spaces-other-than-R-tp3931349p3951273.html
> >>> Sent from the Commons - Dev mailing list archive at Nabble.com.
> >>>
> > ---------------------------------------------------------------------
> > 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] Distributions over sample spaces other than R
Posted by Phil Steitz <ph...@gmail.com>.
On 11/1/11 1:05 AM, Mikkel Meyer Andersen wrote:
> 2011/10/30 Phil Steitz <ph...@gmail.com>:
>> On 10/29/11 10:20 AM, cwinter wrote:
>>> Phil Steitz wrote:
>>>> I would say pull DiscreteDistribution out. That is where the
>>>> difference really lies. I have thought about suggesting that we
>>>> eliminate it altogether; but I still think there may be value in
>>>> supporting discrete distributions over sample spaces that are not
>>>> embedded in the integers.
>>>>
>>>> Phil
>>>>
>>> Empirical distributions are discrete by nature. Depending on the underlying
>>> data, the domain is usually (a subset of) the reals or the integers.
>>> However, after moving probability(double) to Distribution,
>>> DiscreteDistribution will be an empty interface. Thus there is in fact the
>>> question whether it should be eliminated. Otherwise it would be just a
>>> "flag" for discrete distributions and that's indeed independent of the
>>> sample space.
>> Maybe it would be best to eliminate IntegerDistribution then and
>> merge Distribution and ContinuousDistribution, so we have two roots
>> - DiscreteDistribution and ContinuousDistribution. The only reason
>> really to have DiscreteDistribution is if we want to support
>> distributions of RVs over sample spaces that are not subsets of Z.
>> There does not seem to be much enthusiasm for that (i.e.
>> parameterizing the type of the domain of the distribution and pmf),
>> so we might as well just collapse Discrete and Integer. Once you
>> pull out Discrete/Integer, there is not much value any more in
>> Distribution as a parent, so why not just drop both
>> IntegerDistribution and Distribution and move to two roots with
>> doubles / ints as domains and contracts cleaned up to deal with
>> discrete vs continuous cases consistently.
> If we have these two roots, I would propose an Distribution interface
> with e.g. with cdf and inverse cdf. Alternatively, an abstract class
> implementing a default solver for the inverse cdf. We might be able to
> make this generic parameterising the argument to cdf and others.
The only way for this to work is to parameterize the type of the
sample space, which will then force Double to be used for the
continuous case. Why is it so bad to have two roots?
What exactly do we gain by having the common parent? The inverse
cdf machinery will work only for the continuous (by that, I mean
real-valued RV) case. Note how it is overriden now in
AbstractIntegerDistribution. So why not just leave that alone and
separate out the discrete/integer/whatever-we-want-to-call-it case?
Discrete distributions are fundamentally different. They have
pmfs. They have discrete value sets. Inversion works differently.
Inequalities work differently. Why not just cleanly separate?
Phil
>
> In my opinion, we benefit from having one such common ancestor instead
> of two "independent" linages.
>
>> Phil
>>> Christian
>>>
>>> --
>>> View this message in context: http://apache-commons.680414.n4.nabble.com/math-Distributions-over-sample-spaces-other-than-R-tp3931349p3951273.html
>>> Sent from the Commons - Dev mailing list archive at Nabble.com.
>>>
> ---------------------------------------------------------------------
> 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] Distributions over sample spaces other than R
Posted by Mikkel Meyer Andersen <mi...@mikl.dk>.
2011/10/30 Phil Steitz <ph...@gmail.com>:
> On 10/29/11 10:20 AM, cwinter wrote:
>> Phil Steitz wrote:
>>> I would say pull DiscreteDistribution out. That is where the
>>> difference really lies. I have thought about suggesting that we
>>> eliminate it altogether; but I still think there may be value in
>>> supporting discrete distributions over sample spaces that are not
>>> embedded in the integers.
>>>
>>> Phil
>>>
>> Empirical distributions are discrete by nature. Depending on the underlying
>> data, the domain is usually (a subset of) the reals or the integers.
>> However, after moving probability(double) to Distribution,
>> DiscreteDistribution will be an empty interface. Thus there is in fact the
>> question whether it should be eliminated. Otherwise it would be just a
>> "flag" for discrete distributions and that's indeed independent of the
>> sample space.
>
> Maybe it would be best to eliminate IntegerDistribution then and
> merge Distribution and ContinuousDistribution, so we have two roots
> - DiscreteDistribution and ContinuousDistribution. The only reason
> really to have DiscreteDistribution is if we want to support
> distributions of RVs over sample spaces that are not subsets of Z.
> There does not seem to be much enthusiasm for that (i.e.
> parameterizing the type of the domain of the distribution and pmf),
> so we might as well just collapse Discrete and Integer. Once you
> pull out Discrete/Integer, there is not much value any more in
> Distribution as a parent, so why not just drop both
> IntegerDistribution and Distribution and move to two roots with
> doubles / ints as domains and contracts cleaned up to deal with
> discrete vs continuous cases consistently.
If we have these two roots, I would propose an Distribution interface
with e.g. with cdf and inverse cdf. Alternatively, an abstract class
implementing a default solver for the inverse cdf. We might be able to
make this generic parameterising the argument to cdf and others.
In my opinion, we benefit from having one such common ancestor instead
of two "independent" linages.
>
> Phil
>>
>> Christian
>>
>> --
>> View this message in context: http://apache-commons.680414.n4.nabble.com/math-Distributions-over-sample-spaces-other-than-R-tp3931349p3951273.html
>> Sent from the Commons - Dev mailing list archive at Nabble.com.
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [math] Distributions over sample spaces other than R
Posted by Phil Steitz <ph...@gmail.com>.
On 10/29/11 10:20 AM, cwinter wrote:
> Phil Steitz wrote:
>> I would say pull DiscreteDistribution out. That is where the
>> difference really lies. I have thought about suggesting that we
>> eliminate it altogether; but I still think there may be value in
>> supporting discrete distributions over sample spaces that are not
>> embedded in the integers.
>>
>> Phil
>>
> Empirical distributions are discrete by nature. Depending on the underlying
> data, the domain is usually (a subset of) the reals or the integers.
> However, after moving probability(double) to Distribution,
> DiscreteDistribution will be an empty interface. Thus there is in fact the
> question whether it should be eliminated. Otherwise it would be just a
> "flag" for discrete distributions and that's indeed independent of the
> sample space.
Maybe it would be best to eliminate IntegerDistribution then and
merge Distribution and ContinuousDistribution, so we have two roots
- DiscreteDistribution and ContinuousDistribution. The only reason
really to have DiscreteDistribution is if we want to support
distributions of RVs over sample spaces that are not subsets of Z.
There does not seem to be much enthusiasm for that (i.e.
parameterizing the type of the domain of the distribution and pmf),
so we might as well just collapse Discrete and Integer. Once you
pull out Discrete/Integer, there is not much value any more in
Distribution as a parent, so why not just drop both
IntegerDistribution and Distribution and move to two roots with
doubles / ints as domains and contracts cleaned up to deal with
discrete vs continuous cases consistently.
Phil
>
> Christian
>
> --
> View this message in context: http://apache-commons.680414.n4.nabble.com/math-Distributions-over-sample-spaces-other-than-R-tp3931349p3951273.html
> Sent from the Commons - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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] Distributions over sample spaces other than R
Posted by cwinter <ch...@aol.com>.
Phil Steitz wrote:
>
> I would say pull DiscreteDistribution out. That is where the
> difference really lies. I have thought about suggesting that we
> eliminate it altogether; but I still think there may be value in
> supporting discrete distributions over sample spaces that are not
> embedded in the integers.
>
> Phil
>
Empirical distributions are discrete by nature. Depending on the underlying
data, the domain is usually (a subset of) the reals or the integers.
However, after moving probability(double) to Distribution,
DiscreteDistribution will be an empty interface. Thus there is in fact the
question whether it should be eliminated. Otherwise it would be just a
"flag" for discrete distributions and that's indeed independent of the
sample space.
Christian
--
View this message in context: http://apache-commons.680414.n4.nabble.com/math-Distributions-over-sample-spaces-other-than-R-tp3931349p3951273.html
Sent from the Commons - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [math] Distributions over sample spaces other than R
Posted by Phil Steitz <ph...@gmail.com>.
On 10/29/11 9:07 AM, cwinter wrote:
> cwinter wrote:
>> [...] Regarding IntergerDistribution I don't have a preference on leaving
>> it in the current hierarchy or making it to a new root.
>>
>> Christian
>>
> Just now, while pulling inverseCumulativeProbability form
> ContinuousDistribution up to Distribution, I got a conflict with
> IntegerDistribution: IntegerDistribution.inverseCumulativeProbability wants
> to return int which doesn't fit to the return type double of
> Distribution.inverseCumulativeProbability.
> Either the return type has to be changed to double for all integer
> distributions - which is quite annoying - or we need to pull
> IntegerDistribution out of the hierachy - which is my favorite now. For the
> case that there is a requirement for embedding the domain into the reals, we
> could implement the procedure IntegerDistribution.toDiscreteDistribution()
> returning the appropriate DiscreteDistribution.
I would say pull DiscreteDistribution out. That is where the
difference really lies. I have thought about suggesting that we
eliminate it altogether; but I still think there may be value in
supporting discrete distributions over sample spaces that are not
embedded in the integers.
Phil
>
> Best Regards,
> Christian
>
>
> --
> View this message in context: http://apache-commons.680414.n4.nabble.com/math-Distributions-over-sample-spaces-other-than-R-tp3931349p3951113.html
> Sent from the Commons - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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] Distributions over sample spaces other than R
Posted by cwinter <ch...@aol.com>.
cwinter wrote:
>
> [...] Regarding IntergerDistribution I don't have a preference on leaving
> it in the current hierarchy or making it to a new root.
>
> Christian
>
Just now, while pulling inverseCumulativeProbability form
ContinuousDistribution up to Distribution, I got a conflict with
IntegerDistribution: IntegerDistribution.inverseCumulativeProbability wants
to return int which doesn't fit to the return type double of
Distribution.inverseCumulativeProbability.
Either the return type has to be changed to double for all integer
distributions - which is quite annoying - or we need to pull
IntegerDistribution out of the hierachy - which is my favorite now. For the
case that there is a requirement for embedding the domain into the reals, we
could implement the procedure IntegerDistribution.toDiscreteDistribution()
returning the appropriate DiscreteDistribution.
Best Regards,
Christian
--
View this message in context: http://apache-commons.680414.n4.nabble.com/math-Distributions-over-sample-spaces-other-than-R-tp3931349p3951113.html
Sent from the Commons - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [math] Distributions over sample spaces other than R
Posted by cwinter <ch...@aol.com>.
Phil Steitz wrote:
>
> The one exception is our own IntegerDistribution, which is arguably
> being forced into an unnatural structure because its sample space is
> being artificially extended to R. I am not sure how unnatural it
> would be to just have the probability functions take a class
> parameter. I agree, though, that if there is no compelling
> practical need, we should keep it simple. Could be in that case,
> though, that it might be better to pull DiscreteDistribution out of
> the hierarchy and have its probability functions take ints rather
> than doubles. IIRC, I argued for that years ago, but others thought
> it better to go with a single-rooted hierarchy.
>
> Phil
>
Having a class parameter for the domain of a distributions doesn't seem to
be unatural, but I also think that it makes things too complicated. Maybe
the HasDensity interface has been dropped for that reason. Looking at the
function interfaces in the analysis package shows that a multi-rooted
approach works fine. Regarding IntergerDistribution I don't have a
preference on leaving it in the current hierarchy or making it to a new
root.
Christian
--
View this message in context: http://apache-commons.680414.n4.nabble.com/math-Distributions-over-sample-spaces-other-than-R-tp3931349p3938185.html
Sent from the Commons - Dev mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [math] Distributions over sample spaces other than R
Posted by Ted Dunning <te...@gmail.com>.
On Sun, Oct 23, 2011 at 6:50 PM, Phil Steitz <ph...@gmail.com> wrote:
> On 10/23/11 4:36 PM, Ted Dunning wrote:
> > I think it isn't much to worry about forcing all the current stuff into
> an
> > unnatural structure for use cases that are not particularly common.
> >
> > The cases that I have seen for distributions over non-reals are
> permutations
> > and graphs. In neither case did I feel an urge to file a bug against
> > java.lang.Random because it returned a primitive double.
>
> The one exception is our own IntegerDistribution, which is arguably
> being forced into an unnatural structure because its sample space is
> being artificially extended to R. I am not sure how unnatural it
> would be to just have the probability functions take a class
> parameter. I agree, though, that if there is no compelling
> practical need, we should keep it simple. Could be in that case,
> though, that it might be better to pull DiscreteDistribution out of
> the hierarchy and have its probability functions take ints rather
> than doubles. IIRC, I argued for that years ago, but others thought
> it better to go with a single-rooted hierarchy.
>
My experience with R leads me to think that integers embedded in R isn't a
big deal. It isn't even something that I often notice. The problem is
things that don't embed nicely in floating point representations (like
permutations).
Re: [math] Distributions over sample spaces other than R
Posted by Phil Steitz <ph...@gmail.com>.
On 10/23/11 4:36 PM, Ted Dunning wrote:
> I think it isn't much to worry about forcing all the current stuff into an
> unnatural structure for use cases that are not particularly common.
>
> The cases that I have seen for distributions over non-reals are permutations
> and graphs. In neither case did I feel an urge to file a bug against
> java.lang.Random because it returned a primitive double.
The one exception is our own IntegerDistribution, which is arguably
being forced into an unnatural structure because its sample space is
being artificially extended to R. I am not sure how unnatural it
would be to just have the probability functions take a class
parameter. I agree, though, that if there is no compelling
practical need, we should keep it simple. Could be in that case,
though, that it might be better to pull DiscreteDistribution out of
the hierarchy and have its probability functions take ints rather
than doubles. IIRC, I argued for that years ago, but others thought
it better to go with a single-rooted hierarchy.
Phil
>
> On Sun, Oct 23, 2011 at 2:15 PM, Phil Steitz <ph...@gmail.com> wrote:
>
>> Comments on [math-692] have made me curious about how might we run
>> into discrete distributions that do not extend
>> AbstractIntegerDistribution in practical applications. Does anyone
>> have the need for this? One reason that I am asking about this is
>> that I have always felt a little funny about basically forcing
>> sample spaces of probability spaces to be subsets of R by the setup
>> we have. The way we are forced to remap values in
>> IntegerDistribution is a little smelly and to actually compute
>> anything for discrete distributions in the current setup, their
>> sample spaces have to be mapped to some subset of the integers. I
>> like the setup for classical continuous distributions over R and can
>> live with it for discrete distributions over Z, which is all that we
>> have ever implemented. To model the more general case, we would
>> have to parameterize the type of the sample space. This may make
>> sense and have value in the discrete case; but if done at the top of
>> the hierarchy it would complicate things for the currently
>> implemented distributions and force use of Double everywhere in
>> place of double. If the only practical use case we can identify is
>> discrete distributions over non-Integer domains, we could just
>> create some kind of adapter. Any thoughts on this?
>>
>> Phil
>>
>> ---------------------------------------------------------------------
>> 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] Distributions over sample spaces other than R
Posted by Ted Dunning <te...@gmail.com>.
I think it isn't much to worry about forcing all the current stuff into an
unnatural structure for use cases that are not particularly common.
The cases that I have seen for distributions over non-reals are permutations
and graphs. In neither case did I feel an urge to file a bug against
java.lang.Random because it returned a primitive double.
On Sun, Oct 23, 2011 at 2:15 PM, Phil Steitz <ph...@gmail.com> wrote:
> Comments on [math-692] have made me curious about how might we run
> into discrete distributions that do not extend
> AbstractIntegerDistribution in practical applications. Does anyone
> have the need for this? One reason that I am asking about this is
> that I have always felt a little funny about basically forcing
> sample spaces of probability spaces to be subsets of R by the setup
> we have. The way we are forced to remap values in
> IntegerDistribution is a little smelly and to actually compute
> anything for discrete distributions in the current setup, their
> sample spaces have to be mapped to some subset of the integers. I
> like the setup for classical continuous distributions over R and can
> live with it for discrete distributions over Z, which is all that we
> have ever implemented. To model the more general case, we would
> have to parameterize the type of the sample space. This may make
> sense and have value in the discrete case; but if done at the top of
> the hierarchy it would complicate things for the currently
> implemented distributions and force use of Double everywhere in
> place of double. If the only practical use case we can identify is
> discrete distributions over non-Integer domains, we could just
> create some kind of adapter. Any thoughts on this?
>
> Phil
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>