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 ? Machine Learning
avec Scikit-Learn
Voir le programme détaillé
Module « scipy.stats »

Fonction exp - module scipy.stats

Signature de la fonction exp

def exp(X) 

Description

help(scipy.stats.exp)

Natural exponential of a random variable

Parameters
----------
X : `ContinuousDistribution`
    The random variable :math:`X`.

Returns
-------
Y : `ContinuousDistribution`
    A random variable :math:`Y = \exp(X)`.

Examples
--------
Suppose we have a normally distributed random variable :math:`X`:

>>> import numpy as np
>>> from scipy import stats
>>> X = stats.Normal()

We wish to have a lognormally distributed random variable :math:`Y`,
a random variable whose natural logarithm is :math:`X`.
If :math:`X` is to be the natural logarithm of :math:`Y`, then we
must take :math:`Y` to be the natural exponential of :math:`X`.

>>> Y = stats.exp(X)

To demonstrate that ``X`` represents the logarithm of ``Y``,
we plot a normalized histogram of the logarithm of observations of
``Y`` against the PDF underlying ``X``.

>>> import matplotlib.pyplot as plt
>>> rng = np.random.default_rng(435383595582522)
>>> y = Y.sample(shape=10000, rng=rng)
>>> ax = plt.gca()
>>> ax.hist(np.log(y), bins=50, density=True)
>>> X.plot(ax=ax)
>>> plt.legend(('PDF of `X`', 'histogram of `log(y)`'))
>>> plt.show()



Vous êtes un professionnel et vous avez besoin d'une formation ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé