[Numpy-discussion] Inaccurate documentation of the random c-api

2021-04-18 Thread zoj613
Hi All,

https://numpy.org/devdocs/reference/random/c-api.html has an inaccurate
description of the API that goes as follows:
"/zig in the name are based on a ziggurat lookup algorithm is used instead
of calculating the log, which is significantly faster. The non-ziggurat
variants are used in corner cases and for legacy compatibility./". It
appears this is no longer the case and instead there are functions that have
`inv` in the name to signal the use of the inverse method for sampling. I
submited a PR to reflect this and also added the missing function signatures
at https://github.com/numpy/numpy/pull/18797/files

Regards




--
Sent from: http://numpy-discussion.10968.n7.nabble.com/
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] GSoD'21 Ideas Disussion

2021-04-18 Thread Mukulika Pahari
Hello everyone!
I am Mukulika Pahari, a Computer Engineering student from India. I wanted
to implement the following ideas for Google Summer of Docs 2021 if given
the opportunity. I have referred to both- the GSoD proposal

and the NEP 44
 proposal.
Please give me feedback about the ideas!


   1.

   Reorganising contents of the documentation into Reference Guide,
   How-Tos, Tutorials and Explanations as per structure proposed in NEP 44
   .


   -

   Auditing existing documentation
   -

   Clearing misplaced content for example Explanations in Reference Guide,
   How-Tos in Explanations etc.
   -

   Establishing distinct Reference, How-Tos, Tutorials and Explanations
   sections with crosslinking where required


   1.

   Reorganising landing page of NumPy docs .


   -

   Moving the documentation structure to the left sidebar
   -

   Having NumPy Quickstart as the first thing people see when they land on
   Documentation


   1.

   Writing new must-have tutorials (based on most-searched tutorials on
   Google).


   -

   “How to write a tutorial” guide
   -

   3 Beginner Tutorials
   -

   3 Intermediate Tutorials
   -

   3 Advanced Tutorials


   1.

   Writing How-Tos based on most-used functions, most asked doubts on
   StackOverflow, etc.
   2.

   Revamping the User Guide.


   -

   Updating out-of-date references and refactoring content to the latest
   best practices
   -

   Adding non-textual images or graphics to enhance the textual explanations
   -

   Removing duplication to improve searchability


I have proposed this work keeping in mind 30ish weeks of work including
a few weeks for becoming familiar with the organisation and ironing out
details like exactly which tutorials and how-tos to write. Please let me
know if I can aim to achieve more in the timeframe.

My experience with NumPy is currently limited to one data analysis project
but I would love to learn more about its applications while restructuring
and developing its docs!

Thank you for your time.
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] two questions about `choose`

2021-04-18 Thread Alan G. Isaac

I think you are saying that this current behavior of `choose` should
be considered a bug. I hope not, because as illustrated, it is useful.
How would you propose to efficiently do the same substitutions?


On 4/17/2021 4:27 PM, Kevin Sheppard wrote:
2. I would describe this a a bug. I think sequences are converted to arrays and in this case the conversion is not returning a 2 element object array but 
expanding and then concatenation.



On Sat, Apr 17, 2021, 18:56 Alan G. Isaac mailto:alan.is...@gmail.com>> wrote:



2. Separately, mypy is unhappy with my 2nd argument to `choose`:
Argument 2 to "choose" has incompatible type "Tuple[int, Sequence[float]]";
expected "Union[Union[int, float, complex, str, bytes, generic], 
Sequence[Union[int, float, complex, str, bytes, generic]],
Sequence[Sequence[Any]],_SupportsArray]"
However, `choose` is happy to have e.g. `choices=(0,seq)` (and I hope it 
will remain so!).

E.g.,
a = a = (0,1,1,0,0,0,1,1)  #binary array
np.choose(a, (0,range(8))     #array([0, 1, 2, 0, 0, 0, 6, 7])

___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


[Numpy-discussion] ANN: MyGrad 2.0 - Drop-in autodiff for NumPy

2021-04-18 Thread Ryan Soklaski
All,

I am excited to announce the release of MyGrad 2.0.

MyGrad's primary goal is to make automatic differentiation accessible and
easy to use across the NumPy ecosystem (see [1] for more detailed comments).

Source: https://github.com/rsokl/MyGrad
Docs: https://mygrad.readthedocs.io/en/latest/

MyGrad's only dependency is NumPy and (as of version 2.0) it makes keen use
of NumPy's excellent protocols for overriding functions and ufuncs. Thus
you can "drop in" a mygrad-tensor into your pure NumPy code and compute
derivatives through it.

Ultimately, MyGrad could be extended to bring autodiff to other array-based
libraries like CuPy, Sparse, and Dask.

For full release notes see [2]. Feedback, critiques, and ideas are welcome!

Cheers,
Ryan Soklaski

[1] MyGrad is not meant to "compete" with the likes of PyTorch and JAX,
which are fantastically-fast and powerful autodiff libraries. Rather, its
emphasis is on being lightweight and seamless to use in NumPy-centric
workflows.
[2] https://mygrad.readthedocs.io/en/latest/changes.html#v2-0-0
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] two questions about `choose`

2021-04-18 Thread Robert Kern
On Sat, Apr 17, 2021 at 4:28 PM Kevin Sheppard 
wrote:

> 1. I suppose it only uses the (Native int or int64) dtype since each one
> would need a code path to run quickly.
>
> 2. I would describe this a a bug. I think sequences are converted to
> arrays and in this case the conversion is not returning a 2 element object
> array but expanding and then concatenation.
>

No, it's broadcasting the two to a common shape, as documented.
https://numpy.org/doc/stable/reference/generated/numpy.choose.html


> E.g.,
>> a = a = (0,1,1,0,0,0,1,1)  #binary array
>> np.choose(a, (0,range(8)) #array([0, 1, 2, 0, 0, 0, 6, 7])
>>
>
This is equivalent to `np.choose(a, (np.zeros(8, dtype=int), range(8)))`

-- 
Robert Kern
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] two questions about `choose`

2021-04-18 Thread Kevin Sheppard
Oh. I answered thinking about choice and not choose. Please ignore both
parts.

On Sun, Apr 18, 2021, 17:56 Robert Kern  wrote:

> On Sat, Apr 17, 2021 at 4:28 PM Kevin Sheppard 
> wrote:
>
>> 1. I suppose it only uses the (Native int or int64) dtype since each one
>> would need a code path to run quickly.
>>
>> 2. I would describe this a a bug. I think sequences are converted to
>> arrays and in this case the conversion is not returning a 2 element object
>> array but expanding and then concatenation.
>>
>
> No, it's broadcasting the two to a common shape, as documented.
> https://numpy.org/doc/stable/reference/generated/numpy.choose.html
>
>
>> E.g.,
>>> a = a = (0,1,1,0,0,0,1,1)  #binary array
>>> np.choose(a, (0,range(8)) #array([0, 1, 2, 0, 0, 0, 6, 7])
>>>
>>
> This is equivalent to `np.choose(a, (np.zeros(8, dtype=int), range(8)))`
>
> --
> Robert Kern
> ___
> NumPy-Discussion mailing list
> NumPy-Discussion@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] ANN: MyGrad 2.0 - Drop-in autodiff for NumPy

2021-04-18 Thread Stephan Hoyer
On Sun, Apr 18, 2021 at 9:11 AM Ryan Soklaski  wrote:

> MyGrad is not meant to "compete" with the likes of PyTorch and JAX, which
> are fantastically-fast and powerful autodiff libraries. Rather, its
> emphasis is on being lightweight and seamless to use in NumPy-centric
> workflows.
>

Thanks for sharing, this looks like an interesting project!

I would also be curious how MyGrad compares to Autograd [1], which is
currently probably the most popular package implementing "drop-in autodiff
for NumPy." From a quick look, it appears that you take a slightly
different approach for the design -- object oriented rather than functional.

[1] https://github.com/HIPS/autograd
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion