ot.datasets

Simple example datasets

Functions

ot.datasets.make_1D_gauss(n, m, s)[source]

return a 1D histogram for a gaussian distribution (n bins, mean m and std s)

Parameters
  • n (int) – number of bins in the histogram

  • m (float) – mean value of the gaussian distribution

  • s (float) – standard deviaton of the gaussian distribution

Returns

h – 1D histogram for a gaussian distribution

Return type

ndarray (n,)

Examples using ot.datasets.make_1D_gauss

ot.datasets.make_2D_samples_gauss(n, m, sigma, random_state=None)[source]

Return n samples drawn from 2D gaussian \(\mathcal{N}(m, \sigma)\)

Parameters
  • n (int) – number of samples to make

  • m (ndarray, shape (2,)) – mean value of the gaussian distribution

  • sigma (ndarray, shape (2, 2)) – covariance matrix of the gaussian distribution

  • random_state (int, RandomState instance or None, optional (default=None)) – If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.

Returns

X – n samples drawn from \(\mathcal{N}(m, \sigma)\).

Return type

ndarray, shape (n, 2)

Examples using ot.datasets.make_2D_samples_gauss

ot.datasets.make_data_classif(dataset, n, nz=0.5, theta=0, p=0.5, random_state=None, **kwargs)[source]

Dataset generation for classification problems

Parameters
  • dataset (str) – type of classification problem (see code)

  • n (int) – number of training samples

  • nz (float) – noise level (>0)

  • p (float) – proportion of one class in the binary setting

  • random_state (int, RandomState instance or None, optional (default=None)) – If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by np.random.

Returns

  • X (ndarray, shape (n, d)) – n observation of size d

  • y (ndarray, shape (n,)) – labels of the samples.

Examples using ot.datasets.make_data_classif