new numpy docs, missing function and parse error - dirichlet distribution

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

new numpy docs, missing function and parse error - dirichlet distribution

josef.pktd
Hi,
I was just looking around at the new numpy documentation and got a
xhtml parsing error on the page (with Firefox):

http://mentat.za.net/numpy/refguide/random.xhtml#index-29351

The offending line contains
$X pprox prod_{i=1}^{k}{x^{lpha_i-1}_i}$<
in the docstring of the dirichlet distribution

the corresponding line in the source at
http://projects.scipy.org/scipy/numpy/browser/trunk/numpy/random/mtrand/mtrand.pyx
is
.. math:: X \\approx \\prod_{i=1}^{k}{x^{\\alpha_i-1}_i}

(I have no idea, why it seems not to parse \\a correctly).

When looking for this, I found that the Dirichlet distribution is
missing from the new Docstring Wiki, http://sd-2116.dedibox.fr/doc/Docstrings/numpy/random


Then I saw that Dirichlet is also missing in  __all__ in
http://projects.scipy.org/scipy/numpy/browser/trunk/numpy/random/info.py

As a consequence numpy.lookfor does not find Dirichlet
>>> numpy.lookfor('dirichlet')
Search results for 'dirichlet'
------------------------------
>>> import numpy.random
>>> dir(numpy.random)
contains dirichlet
>>> numpy.random.__all__
does not contain dirichlet.

To me this seems to be a documentation bug.

Josef

_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: new numpy docs, missing function and parse error - dirichlet distribution

josef.pktd


On May 22, 11:11 am, joep <[hidden email]> wrote:
> Hi,

> When looking for this, I found that the Dirichlet distribution is
> missing from the new Docstring Wiki,http://sd-2116.dedibox.fr/doc/Docstrings/numpy/random

Actually, a search on the wiki finds dirichlet in
http://sd-2116.dedibox.fr/doc/Docstrings/numpy/random/mtrand/dirichlet

I found random/mtrand only through the search, it doesn't seem to be
linked from anywhere

Is it intentional that function that are imported inside numpy might
have the same docstring assigned to several different wiki pages, and
might get edited on different pages?

Since all distribution (except for dirichlet) are included in
numpy.random.__all__, these distribution show up on two different
pages, e.g.
http://sd-2116.dedibox.fr/doc/Docstrings/numpy/random/poisson
and
http://sd-2116.dedibox.fr/doc/Docstrings/numpy/random/mtrand/poisson


So except for the strange parsing of the dirichlet docstring, this is
a problem with numpy:

numpy.random.__all__ as defined in numpy/random/info.py does not
expose Dirichlet

Josef

_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: new numpy docs, missing function and parse error - dirichlet distribution

Pauli Virtanen-3
to, 2008-05-22 kello 09:51 -0700, joep kirjoitti:

>
> On May 22, 11:11 am, joep <[hidden email]> wrote:
> > Hi,
>
> > When looking for this, I found that the Dirichlet distribution is
> > missing from the new Docstring Wiki,http://sd-2116.dedibox.fr/doc/Docstrings/numpy/random
>
> Actually, a search on the wiki finds dirichlet in
> http://sd-2116.dedibox.fr/doc/Docstrings/numpy/random/mtrand/dirichlet
>
> I found random/mtrand only through the search, it doesn't seem to be
> linked from anywhere

It's not in __all__ of numpy.random, and is stripped from the content
list because of that.

> Is it intentional that function that are imported inside numpy might
> have the same docstring assigned to several different wiki pages, and
> might get edited on different pages?
>
> Since all distribution (except for dirichlet) are included in
> numpy.random.__all__, these distribution show up on two different
> pages, e.g.
> http://sd-2116.dedibox.fr/doc/Docstrings/numpy/random/poisson
> and
> http://sd-2116.dedibox.fr/doc/Docstrings/numpy/random/mtrand/poisson

It is not intentional. And for the majority of cases this does not
happen, and I can fix this for numpy.random.mtrand. Thanks for
reporting.

        Pauli


_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: new numpy docs, missing function and parse error - dirichlet distribution

josef.pktd


On May 22, 1:30 pm, Pauli Virtanen <[hidden email]> wrote:
> to, 2008-05-22 kello 09:51 -0700, joep kirjoitti:
>

> 
> It is not intentional. And for the majority of cases this does not
> happen, and I can fix this for numpy.random.mtrand. Thanks for
> reporting.
>

I was looking some more at the __all__ statements and trying to figure
out what the system/idea behind the imports and exposure of functions
at different places is. I did not find any other full duplication as
with mtrand so far.

However, when I do a search on the DocWiki for example for arccos (or
log, log10, exp, tan,...), I see it 9 times, and it is not clear which
ones refer to the same docstring and where several imports of the same
function are picked up separately, and which ones refer to actually
different functions in the source.

numpy.lookfor('arccos') yields 3 results, with 3 different doc
strings, the other 6 might be duplicates.

http://sd-2116.dedibox.fr/doc/Docstrings/numpy/lib/scimath/arccos
has the most informative docstring
In numpy it is exposed as ``numpy.emath.arccos``

A recommendation for docstring editing might be to verify duplicates
and copy doc strings if the function is (almost) duplicated or
triplicated in the numpy source and possibly cross link different
versions.

When I start from the DocWiki front page, I seem to be able to follow
links only to one version of any docstring, but any search leads to
the multiple exposer of the same function.

Josef
_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: new numpy docs, missing function and parse error - dirichlet distribution

Pauli Virtanen-3
to, 2008-05-22 kello 11:28 -0700, joep kirjoitti:
[clip]
> However, when I do a search on the DocWiki for example for arccos (or
> log, log10, exp, tan,...), I see it 9 times, and it is not clear which
> ones refer to the same docstring and where several imports of the same
> function are picked up separately, and which ones refer to actually
> different functions in the source.
[clip]
> A recommendation for docstring editing might be to verify duplicates
> and copy doc strings if the function is (almost) duplicated or
> triplicated in the numpy source and possibly cross link different
> versions.

This is a problem with the tool on handling extension objects and
Pyrex-generated classes, and the editors shouldn't have to concern
themselves with it. I'll fix it and remove any unedited duplicates from
the wiki.

        Pauli


_______________________________________________
Numpy-discussion mailing list
[hidden email]
http://projects.scipy.org/mailman/listinfo/numpy-discussion