Module datasets¶
Synthetic dataset.
-
operalib.datasets.
toy_data_curl_free_field
(n_samples, loc=25, space=0.5)[source]¶ Curl-Free toy dataset.
- Generate a scalar field as mixture of five gaussians at location:
- (0 , 0)
- (0 , loc)
- ( loc, 0)
- (-loc, 0)
- (0 , -loc)
whith variance equal to ‘space’. Then return the gradient of the field. The return result is a pair (inputs, targets) of arrays.
Parameters: - n_samples : int
Number of samples to generate.
- loc: float, optional (default = 25.)
Centers of the Gaussians.
- space: float, optional (default = .5)
Variance of the Gaussians.
Returns: - X : array, shape = [n_samples, 2]
Array of evenly space points.
- y : array shape = [n_samples, 2]
Array corresponding to the velocity at the coordinates present in inputs.
See also
operalib.toy_data_curl_free_mesh
- Generate Curl-Free mesh.
operalib.toy_data_div_free_mesh
- Generate Divergence-Free mesh.
-
operalib.datasets.
toy_data_div_free_mesh
(n_samples, loc=25.0, space=0.5)[source]¶ Divergence-Free toy dataset.
- Generate a scalar field as mixture of five gaussians at location:
- (0 , 0)
- (0 , loc)
- ( loc, 0)
- (-loc, 0)
- (0 , -loc)
whith variance equal to ‘space’. Then return the orthogonal of gradient of the field. The return result is a pair of meshes.
Parameters: - n_points : int
Number of samples to generate.
- loc: float, optional (default = 25.)
Centers of the Gaussians.
- space: float, optional (default = .5)
Variance of the Gaussians.
Returns: - X, Y : :rtype: (array, array), shape = [n, n]
Mesh, X, Y coordinates.
- U, V : :rtype: (array, array), shape = [n, n]
Mesh, (U, V) velocity at (X, Y) coordinates
See also
operalib.toy_data_curl_free_field
- Generate Curl-Free field.
operalib.toy_data_div_free_field
- Generate Divergence-Free field.
-
operalib.datasets.
toy_data_div_free_field
(n_samples, loc=25, space=0.5)[source]¶ Divergence-Free toy dataset.
- Generate a scalar field as mixture of five gaussians at location:
- (0 , 0)
- (0 , loc)
- ( loc, 0)
- (-loc, 0)
- (0 , -loc)
whith variance equal to ‘space’. Then return the orthogonal of gradient of the field. The return result is a pair (inputs, targets) of arrays.
Parameters: - n_points : int
Number of samples to generate.
- loc: float, optional (default = 25.)
Centers of the Gaussians.
- space: float, optional (default = .5)
Variance of the Gaussians.
Returns: - X : array, shape = [n_samples, 2]
Array of evenly space points.
- y : array shape = [n_samples, 2]
Array corresponding to the velocity at the coordinates present in inputs.
See also
operalib.toy_data_div_free_mesh
- Generate Curl-Free mesh.
operalib.toy_data_div_free_mesh
- Generate Divergence-Free mesh.
-
operalib.datasets.
toy_data_curl_free_mesh
(n_samples, loc=25.0, space=0.5)[source]¶ Curl-Free toy dataset.
- Generate a scalar field as mixture of five gaussians at location:
- (0 , 0)
- (0 , loc)
- ( loc, 0)
- (-loc, 0)
- (0 , -loc)
whith variance equal to ‘space’. Then return the gradient of the field. The return result is a pair meshes.
Parameters: - n_samples : int
Number of samples to generate.
- loc: float, optional (default = 25.)
Centers of the Gaussians.
- space: float, optional (default = .5)
Variance of the Gaussians.
Returns: - X, Y : :rtype: (array, array), shape = [n, n]
Mesh, X, Y coordinates.
- U, V : :rtype: (array, array), shape = [n, n]
Mesh, (U, V) velocity at (X, Y) coordinates
See also
operalib.toy_data_curl_free_field
- Generate Curl-Free field.
operalib.toy_data_div_free_field
- Generate Divergence-Free field.
-
operalib.datasets.
array2mesh
(X, side=None)[source]¶ Array to mesh converter.
Parameters: - X : array, shape = [n_samples, 2]
The inputs array.
Returns: - x_mesh : array, shape = [n_samples, n_samples]
The x_axis of the mesh corresponding to inputs.
- y_mesh : array, shape = [n_samples, n_samples]
The y_axis of the mesh corresponding to inputs
-
operalib.datasets.
mesh2array
(x_mesh, y_mesh)[source]¶ Mesh to array converter.
Parameters: - x_mesh : array, shape = [n_samples, n_samples]
The x_axis mesh.
- y_mesh : array, shape = [n_samples, n_samples]
The y_axis mesh.
Returns: - inputs : array, shape = [n_samples, 2]
The inputs corresponding to the mesh (x_mesh, y_mesh).
-
operalib.datasets.
toy_data_quantile
(n_samples=50, probs=0.5, pattern=SinePattern(enveloppe=(0.3333333333333333, 1.0), inputs_bound=(0.0, 1.5), random_state=<mtrand.RandomState object>, sine_period=1.0), noise=(1.0, 0.2, 0.0, 1.5), random_state=None)[source]¶ Sine wave toy dataset.
The target y is computed as a sine curve at of modulated by a sine envelope with some period (default 1/3Hz) and mean (default 1). Moreover, this pattern is distorted with a random Gaussian noise with mean 0 and a linearly decreasing standard deviation (default from 1.2 at X = 0 to 0.2 at X = 1 . 5).
Parameters: - n_samples : int
Number of samples to generate.
- probs : list or float, shape = [n_quantiles], default=0.5
Probabilities (quantiles levels).
- pattern : callable, default = SinePattern()
Callable which generates n_sample 1D data (inputs and targets).
- noise : :rtype: (float, float, float, float)
Noise parameters (variance, shift, support_min, support_max).
Returns: - X : array, shape = [n_samples, 1]
Input data.
- y : array, shape = [n_sample, 1]
Targets.
- quantiles : array, shape = [n_samples x n_quantiles]
True conditional quantiles.