[SciPy-dev] Inconsisten return type from discrete dists.

eric jones eric at enthought.com
Mon Jan 27 17:51:39 EST 2003


> 
> On Sun, 2003-01-26 at 22:28, eric jones wrote:
> [snip]
> > > discovered that the return type from discrete distributions where
> > > inconsistent or rather they all seems to return floats except for
> > > randint. Further, some of them also returns a array of length 1
when
> > > called without size argument while others return a simple number.
> > >
> > > For the first issue I feel that it is more natural for them to
return
> > > ints, the attached patch, return_ints.pathc, fixes that.
> >
> > So you're saying that everything continues to return floats except
for
> > randint which returns ints?  If so, then I agree.
> >
> 
> I don't quite understand what you mean. (My English isn't the best..)

Neither is mine, but I'm betting you have a better excuse than I
do...:-)
> 
> Before it was like this: More than one of the discrete distributions
> returned floats (I did only test a couple of them) and at least one
> (randint) return integers.
> 
> I want them all to return integers and that's what my patch is doing.
> That is what I would expect them to do, but maybe there are other
> applications where floats are more sensible that I don't see.

I was thinking about continuous distributions also -- not just discrete
ones, so it was my misunderstanding.  The behavior you are asking for
sounds right to me.

> 
> If I understand you correctly you want to keep it like it was before,
> or?
> 
> > >
> > > For the second issue I think that it is more convenient if they
always
> > > returns an array. I have no patch for that, but I can fix it if
that
> > is
> > > the consensus.
> >
> > Yes, this sounds appropriate.
> >
> 
> Ok, I'll prepare a patch for this then.
> 
> [snip]
> 
> > Otto, if you would like CVS access to add your tests, let me know.
> >
> 
> As long as I'm just doing smal patches I'm perfectly fine with sending
> patches to the list. But I would like do more substantial
contributions
> in the future and then it would be nice with CVS access. I'll need to
> finish my master thesis first though and I'm going on vacation later
in
> the week so I won't have any time to do any real work before the end
of
> Februari.
> 
> Concerning the unit tests, I have written tests for the rsv's now that
> check's that the result is in the right domain and of right type/size.
I
> then plan to move on with tests for the pdf and cdf. I haven't yet
> decided on how to them, but I was thinking of calculating them with a
> "known good" implementation of them and compare to that. Any other
> suggestions?

Ok.  We'll add access when you're ready.

See ya,
eric





More information about the SciPy-Dev mailing list