module datasets.dummies

Short summary

module papierstat.datasets.dummies

Jeux de données artificiels.

source on GitHub

Functions

function

truncated documentation

line2d

Simule un jeu de données y = ax + b + \epsilon. Notebooks associés à ce jeu de données :

Documentation

Jeux de données artificiels.

source on GitHub

papierstat.datasets.dummies.line2d(n, x0=0, x1=10, a=0.5, b=1, sigma=0.5)[source]

Simule un jeu de données y = ax + b + \epsilon. Notebooks associés à ce jeu de données :

Paramètres
  • n – nombre de points à simuler

  • x0 – dans l’intervalle [x0, x1]

  • x1 – dans l’intervalle [x0, x1]

  • aa

  • bb

  • sigma – écart type du bruit blanc

Renvoie

une matrice

source on GitHub

papierstat.datasets.dummies.rand(d0, d1, ..., dn)

Random values in a given shape.

Note

This is a convenience function for users porting code from Matlab, and wraps numpy.random.random_sample. That function takes a tuple to specify the size of the output, which is consistent with other NumPy functions like numpy.zeros and numpy.ones.

Create an array of the given shape and populate it with random samples from a uniform distribution over [0, 1).

Paramètres

d1, .., dn (d0,) – The dimensions of the returned array, must be non-negative. If no argument is given a single Python float is returned.

Renvoie

out – Random values.

Type renvoyé

ndarray, shape (d0, d1, ..., dn)

Voir aussi

random()

Exemples

>>> np.random.rand(3,2)
array([[ 0.14022471,  0.96360618],  #random
       [ 0.37601032,  0.25528411],  #random
       [ 0.49313049,  0.94909878]]) #random
papierstat.datasets.dummies.randn(d0, d1, ..., dn)

Return a sample (or samples) from the « standard normal » distribution.

Note

This is a convenience function for users porting code from Matlab, and wraps numpy.random.standard_normal. That function takes a tuple to specify the size of the output, which is consistent with other NumPy functions like numpy.zeros and numpy.ones.

If positive int_like arguments are provided, randn generates an array of shape (d0, d1, ..., dn), filled with random floats sampled from a univariate « normal » (Gaussian) distribution of mean 0 and variance 1. A single float randomly sampled from the distribution is returned if no argument is provided.

Paramètres

d1, .., dn (d0,) – The dimensions of the returned array, must be non-negative. If no argument is given a single Python float is returned.

Renvoie

Z – A (d0, d1, ..., dn)-shaped array of floating-point samples from the standard normal distribution, or a single such float if no parameters were supplied.

Type renvoyé

ndarray or float

Voir aussi

standard_normal()

Similar, but takes a tuple as its argument.

normal()

Also accepts mu and sigma arguments.

Notes

For random samples from N(\mu, \sigma^2), use:

sigma * np.random.randn(...) + mu

Exemples

>>> np.random.randn()
2.1923875335537315  # random

Two-by-four array of samples from N(3, 6.25):

>>> 3 + 2.5 * np.random.randn(2, 4)
array([[-4.49401501,  4.00950034, -1.81814867,  7.29718677],   # random
       [ 0.39924804,  4.68456316,  4.99394529,  4.84057254]])  # random