systemml.random package¶
Submodules¶
systemml.random.sampling module¶
-
systemml.random.sampling.
normal
(loc=0.0, scale=1.0, size=(1, 1), sparsity=1.0)¶ Draw random samples from a normal (Gaussian) distribution.
Parameters: - loc (Mean ("centre") of the distribution.) –
- scale (Standard deviation (spread or "width") of the distribution.) –
- size (Output shape (only tuple of length 2, i.e. (m, n), supported)) –
- sparsity (Sparsity (between 0.0 and 1.0)) –
Examples
>>> import systemml as sml >>> import numpy as np >>> sml.setSparkContext(sc) >>> from systemml import random >>> m1 = sml.random.normal(loc=3, scale=2, size=(3,3)) >>> m1.toNumPy() array([[ 3.48857226, 6.17261819, 2.51167259], [ 3.60506708, -1.90266305, 3.97601633], [ 3.62245706, 5.9430881 , 2.53070413]])
-
systemml.random.sampling.
uniform
(low=0.0, high=1.0, size=(1, 1), sparsity=1.0)¶ Draw samples from a uniform distribution.
Parameters: - low (Lower boundary of the output interval.) –
- high (Upper boundary of the output interval.) –
- size (Output shape (only tuple of length 2, i.e. (m, n), supported)) –
- sparsity (Sparsity (between 0.0 and 1.0)) –
Examples
>>> import systemml as sml >>> import numpy as np >>> sml.setSparkContext(sc) >>> from systemml import random >>> m1 = sml.random.uniform(size=(3,3)) >>> m1.toNumPy() array([[ 0.54511396, 0.11937437, 0.72975775], [ 0.14135946, 0.01944448, 0.52544478], [ 0.67582422, 0.87068849, 0.02766852]])
-
systemml.random.sampling.
poisson
(lam=1.0, size=(1, 1), sparsity=1.0)¶ Draw samples from a Poisson distribution.
Parameters: - lam (Expectation of interval, should be > 0.) –
- size (Output shape (only tuple of length 2, i.e. (m, n), supported)) –
- sparsity (Sparsity (between 0.0 and 1.0)) –
Examples
>>> import systemml as sml >>> import numpy as np >>> sml.setSparkContext(sc) >>> from systemml import random >>> m1 = sml.random.poisson(lam=1, size=(3,3)) >>> m1.toNumPy() array([[ 1., 0., 2.], [ 1., 0., 0.], [ 0., 0., 0.]])
Module contents¶
Random Number Generation¶
Univariate distributions | |
---|---|
normal | Normal / Gaussian distribution. |
poisson | Poisson distribution. |
uniform | Uniform distribution. |
-
systemml.random.
normal
(loc=0.0, scale=1.0, size=(1, 1), sparsity=1.0)¶ Draw random samples from a normal (Gaussian) distribution.
Parameters: - loc (Mean ("centre") of the distribution.) –
- scale (Standard deviation (spread or "width") of the distribution.) –
- size (Output shape (only tuple of length 2, i.e. (m, n), supported)) –
- sparsity (Sparsity (between 0.0 and 1.0)) –
Examples
>>> import systemml as sml >>> import numpy as np >>> sml.setSparkContext(sc) >>> from systemml import random >>> m1 = sml.random.normal(loc=3, scale=2, size=(3,3)) >>> m1.toNumPy() array([[ 3.48857226, 6.17261819, 2.51167259], [ 3.60506708, -1.90266305, 3.97601633], [ 3.62245706, 5.9430881 , 2.53070413]])
-
systemml.random.
uniform
(low=0.0, high=1.0, size=(1, 1), sparsity=1.0)¶ Draw samples from a uniform distribution.
Parameters: - low (Lower boundary of the output interval.) –
- high (Upper boundary of the output interval.) –
- size (Output shape (only tuple of length 2, i.e. (m, n), supported)) –
- sparsity (Sparsity (between 0.0 and 1.0)) –
Examples
>>> import systemml as sml >>> import numpy as np >>> sml.setSparkContext(sc) >>> from systemml import random >>> m1 = sml.random.uniform(size=(3,3)) >>> m1.toNumPy() array([[ 0.54511396, 0.11937437, 0.72975775], [ 0.14135946, 0.01944448, 0.52544478], [ 0.67582422, 0.87068849, 0.02766852]])
-
systemml.random.
poisson
(lam=1.0, size=(1, 1), sparsity=1.0)¶ Draw samples from a Poisson distribution.
Parameters: - lam (Expectation of interval, should be > 0.) –
- size (Output shape (only tuple of length 2, i.e. (m, n), supported)) –
- sparsity (Sparsity (between 0.0 and 1.0)) –
Examples
>>> import systemml as sml >>> import numpy as np >>> sml.setSparkContext(sc) >>> from systemml import random >>> m1 = sml.random.poisson(lam=1, size=(3,3)) >>> m1.toNumPy() array([[ 1., 0., 2.], [ 1., 0., 0.], [ 0., 0., 0.]])