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 ? RAG (Retrieval-Augmented Generation)
et Fine Tuning d'un LLM
Voir le programme détaillé
Module « numpy.random »

Classe « Generator »

Informations générales

Héritage

builtins.object
    Generator

Définition

class Generator(builtins.object):

help(Generator)

    Generator(bit_generator)

    Container for the BitGenerators.

    `Generator` exposes a number of methods for generating random
    numbers drawn from a variety of probability distributions. In addition to
    the distribution-specific arguments, each method takes a keyword argument
    `size` that defaults to ``None``. If `size` is ``None``, then a single
    value is generated and returned. If `size` is an integer, then a 1-D
    array filled with generated values is returned. If `size` is a tuple,
    then an array with that shape is filled and returned.

    The function :func:`numpy.random.default_rng` will instantiate
    a `Generator` with numpy's default `BitGenerator`.

    **No Compatibility Guarantee**

    `Generator` does not provide a version compatibility guarantee. In
    particular, as better algorithms evolve the bit stream may change.

    Parameters
    ----------
    bit_generator : BitGenerator
        BitGenerator to use as the core generator.

    Notes
    -----
    The Python stdlib module :external+python:mod:`random` contains
    pseudo-random number generator with a number of methods that are similar
    to the ones available in `Generator`.
    It uses Mersenne Twister, and this bit generator can
    be accessed using `MT19937`. `Generator`, besides being
    NumPy-aware, has the advantage that it provides a much larger number
    of probability distributions to choose from.

    Examples
    --------
    >>> from numpy.random import Generator, PCG64
    >>> rng = Generator(PCG64())
    >>> rng.standard_normal()
    -0.203  # random

    See Also
    --------
    default_rng : Recommended constructor for `Generator`.
    

Constructeur(s)

Signature du constructeur Description
__new__(*args, **kwargs) Create and return a new object. See help(type) for accurate signature. [extrait de __new__.__doc__]
__init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. [extrait de __init__.__doc__]

Liste des attributs statiques

Nom de l'attribut Valeur
bit_generator<attribute 'bit_generator' of 'numpy.random._generator.Generator' objects>

Liste des opérateurs

Opérateurs hérités de la classe object

__eq__, __ge__, __gt__, __le__, __lt__, __ne__

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__getstate__(self)
__reduce__(self)
__repr__(self)
__setstate__(self, bit_gen)
__str__(self) Return str(self). [extrait de __str__.__doc__]
beta(self, a, b, size=None)
binomial(self, n, p, size=None)
bytes(self, length)
chisquare(self, df, size=None)
choice(self, a, size=None, replace=True, p=None, axis=0, shuffle=True)
dirichlet(self, alpha, size=None)
exponential(self, scale=1.0, size=None)
f(self, dfnum, dfden, size=None)
gamma(self, shape, scale=1.0, size=None)
geometric(self, p, size=None)
gumbel(self, loc=0.0, scale=1.0, size=None)
hypergeometric(self, ngood, nbad, nsample, size=None)
integers(self, low, high=None, size=None, dtype=<class 'numpy.int64'>, endpoint=False)
laplace(self, loc=0.0, scale=1.0, size=None)
logistic(self, loc=0.0, scale=1.0, size=None)
lognormal(self, mean=0.0, sigma=1.0, size=None)
logseries(self, p, size=None)
multinomial(self, n, pvals, size=None)
multivariate_hypergeometric(self, colors, nsample, size=None, method='marginals')
multivariate_normal(self, mean, cov, size=None, check_valid='warn', tol=1e-08, *, method='svd')
negative_binomial(self, n, p, size=None)
noncentral_chisquare(self, df, nonc, size=None)
noncentral_f(self, dfnum, dfden, nonc, size=None)
normal(self, loc=0.0, scale=1.0, size=None)
pareto(self, a, size=None)
permutation(self, x, axis=0)
permuted(self, x, *, axis=None, out=None)
poisson(self, lam=1.0, size=None)
power(self, a, size=None)
random(self, size=None, dtype=<class 'numpy.float64'>, out=None)
rayleigh(self, scale=1.0, size=None)
shuffle(self, x, axis=0)
spawn(self, n_children)
standard_cauchy(self, size=None)
standard_exponential(self, size=None, dtype=<class 'numpy.float64'>, method='zig', out=None)
standard_gamma(self, shape, size=None, dtype=<class 'numpy.float64'>, out=None)
standard_normal(self, size=None, dtype=<class 'numpy.float64'>, out=None)
standard_t(self, df, size=None)
triangular(self, left, mode, right, size=None)
uniform(self, low=0.0, high=1.0, size=None)
vonmises(self, mu, kappa, size=None)
wald(self, mean, scale, size=None)
weibull(self, a, size=None)
zipf(self, a, size=None)

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __getattribute__, __hash__, __init_subclass__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__

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é