[Numpy-discussion] Documentation error in numpy.random.logseries

Vincent Davis vincent at vincentdavis.net
Sat Jun 26 17:34:26 EDT 2010


On Sat, Jun 26, 2010 at 3:18 PM,  <josef.pktd at gmail.com> wrote:
> On Sat, Jun 26, 2010 at 5:12 PM, Vincent Davis <vincent at vincentdavis.net> wrote:
>> On Sat, Jun 26, 2010 at 3:04 PM,  <josef.pktd at gmail.com> wrote:
>>> On Sat, Jun 26, 2010 at 4:58 PM, David Goldsmith
>>> <d.l.goldsmith at gmail.com> wrote:
>>>> On Sat, Jun 26, 2010 at 1:41 PM, Vincent Davis <vincent at vincentdavis.net>
>>>> wrote:
>>>>>
>>>>> numpy.random.logseries(p, size=None)
>>>>>
>>>>> but the parameters section,
>>>>> Parameters:
>>>>> loc : float
>>>>> scale : float > 0.
>>>>> size : {tuple, int}
>>>>> Output shape. If the given shape is, e.g., (m, n, k), then m * n * k
>>>>> samples are drawn.
>>
>> Thanks, I'll file a ticket
>
> Don't file a ticket, just edit the docs. It's just the docstring not the source

Ok, I just need to remember to make the changes :-)
Vincent
>
> the Return is also wrong
>
> samples : {ndarray, scalar}
>    where the values are all integers in [0, n].
>
> sample values are greater or equal to one, but unbound above
>
>>>> stats.logser.pmf(np.arange(10000, 10005),0.99999)
> array([  7.85931402e-06,   7.85844959e-06,   7.85758532e-06,
>         7.85672123e-06,   7.85585731e-06])


>
> Josef
>
>> Vincent
>>
>>>>>
>>>>> Notice that p <> loc and what about scale.
>>>>>
>>>>> I'll file a ticket unless I am mission something,
>>>>> Which should it be loc or p
>>>>> What about scale.
>>>>
>>>> The source is opaque (to me; Cython?) so unless you can decipher it, test
>>>> actual behavior and document that - my guess is that p is short for
>>>> "parameters" and is intended to be a two-element array_like containing both
>>>> the loc and scale parameters, but that's the way it should be documented,
>>>> not with some unprecedented reference to loc and scale when the signature
>>>> specifies p, but as I said, check that first.
>>>
>>>>>> np.source(stats.distributions.logser_gen)
>>>
>>> class logser_gen(rv_discrete):
>>>    def _rvs(self, pr):
>>>        return mtrand.logseries(pr,size=self._size)
>>>    def _argcheck(self, pr):
>>>        return (pr > 0) & (pr < 1)
>>>    def _pmf(self, k, pr):
>>>        return -pr**k * 1.0 / k / log(1-pr)
>>>
>>> p is a probability between in (0,1), just a mistake in the documentation.
>>>
>>>>
>>>>> There is no numpy-dev list right? Should this list be used or the
>>>>> scipy-dev list>
>>>>
>>>> That's a good Q: this is definitely a "bug" in the doc (loc and scale
>>>> shouldn't be documented as such when they're not explicitly in the function
>>>> signature), in which case scipy-dev is the proper place to post, but if it
>>>> turns out to be a bug in the code also, then this is the proper place, since
>>>> all numpy devs are subscribed here, and numpy users should know about
>>>> potential bugs (numpy devs will correct me if I'm wrong).
>>>
>>> I think question about the substance/content of the docstrings should
>>> always go to the mailing list of the corresponding function.
>>>
>>> Josef
>>>
>>>>
>>>> DG
>>>>>
>>>>> Vincent
>>>>> _______________________________________________
>>>>> NumPy-Discussion mailing list
>>>>> NumPy-Discussion at scipy.org
>>>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>>
>>>>
>>>>
>>>> --
>>>> Mathematician: noun, someone who disavows certainty when their uncertainty
>>>> set is non-empty, even if that set has measure zero.
>>>>
>>>> Hope: noun, that delusive spirit which escaped Pandora's jar and, with her
>>>> lies, prevents mankind from committing a general suicide.  (As interpreted
>>>> by Robert Graves)
>>>>
>>>> _______________________________________________
>>>> NumPy-Discussion mailing list
>>>> NumPy-Discussion at scipy.org
>>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>>
>>>>
>>> _______________________________________________
>>> NumPy-Discussion mailing list
>>> NumPy-Discussion at scipy.org
>>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>>
>> _______________________________________________
>> NumPy-Discussion mailing list
>> NumPy-Discussion at scipy.org
>> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>



More information about the NumPy-Discussion mailing list