[SciPy-User] Scipy and information theory

Ralf Gommers ralf.gommers at gmail.com
Fri Nov 8 10:54:32 EST 2019


Hi Iyán,


On Thu, Nov 7, 2019 at 12:21 PM Iyán Méndez Veiga <me at iyanmv.com> wrote:

> Hi,
>
> I discovered recently some interesting functions in scipy that are useful
> in
> the context of information theory. In particular, xlogy, entr and
> rel_entr.
> However, for the calculations I want to do I am interested in using log2
> instead of natural logarithm. I was expecting to be able to choose the
> base
> with this functions but it is not possible.
>
> Do you think it would be a nice feature to add to scipy? Maybe not for a
> general base, but at least the bases that are available in numpy (log2,
> log10).
>

This does sound like a useful feature to add to these functions. I'm not
sure how easy it is to add a keyword to those functions though, since the
ufunc machinery may be limited in flexibility. Maybe someone else can say
straight away. If you want to start looking into implementing this, here
are some notes of where to start:
http://scipy.github.io/devdocs/dev/core-dev/index.html#scipy-special

Cheers,
Ralf


> The workaround I am using with xlogy(x,y) (and similar functions) is
> multiplying x array by log2(e).
>
> Best wishes,
> Iyán
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User at python.org
> https://mail.python.org/mailman/listinfo/scipy-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-user/attachments/20191108/f06b5c12/attachment.html>


More information about the SciPy-User mailing list