Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé
Module « scipy.special »

Fonction kl_div - module scipy.special

Signature de la fonction kl_div

def kl_div(*args, **kwargs) 

Description

help(scipy.special.kl_div)

kl_div(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature])

kl_div(x, y, out=None)

Elementwise function for computing Kullback-Leibler divergence.

.. math::

    \mathrm{kl\_div}(x, y) =
      \begin{cases}
        x \log(x / y) - x + y & x > 0, y > 0 \\
        y & x = 0, y \ge 0 \\
        \infty & \text{otherwise}
      \end{cases}

Parameters
----------
x, y : array_like
    Real arguments
out : ndarray, optional
    Optional output array for the function results

Returns
-------
scalar or ndarray
    Values of the Kullback-Liebler divergence.

See Also
--------
entr, rel_entr, scipy.stats.entropy

Notes
-----
.. versionadded:: 0.15.0

This function is non-negative and is jointly convex in `x` and `y`.

The origin of this function is in convex programming; see [1]_ for
details. This is why the function contains the extra :math:`-x
+ y` terms over what might be expected from the Kullback-Leibler
divergence. For a version of the function without the extra terms,
see `rel_entr`.

References
----------
.. [1] Boyd, Stephen and Lieven Vandenberghe. *Convex optimization*.
       Cambridge University Press, 2004.
       :doi:`https://doi.org/10.1017/CBO9780511804441`


Vous êtes un professionnel et vous avez besoin d'une formation ? Programmation Python
Les fondamentaux
Voir le programme détaillé