Data Generation
This module generates different types of data
line
line (x:numpy.ndarray, a=1.0, b=0.5, interval=[-10.0, 10.0], noise=[0, 1e-05], nsamples=100)
Create a dataset of nsamples in the interval following the linear regression \(y=a x+b\).
Type | Default | Details | |
---|---|---|---|
x | ndarray | ||
a | float | 1.0 | Slope |
b | float | 0.5 | Intercept |
interval | list | [-10.0, 10.0] | Interval for x. |
noise | list | [0, 1e-05] | Noise [\(\mu\),\(\sigma\)] with mean \(\mu\) and standard deviation \(\sigma\) |
nsamples | int | 100 | Number of samples |
Returns | ndarray | the array \(y=ax+b\) |
noisy_line
noisy_line (a=1.0, b=0.5, interval=[-10.0, 10.0], noise=[0, 1e-05], nsamples=100)
Create a dataset of nsamples in the interval following the linear regression \(y=a x+b\) and adds a gaussian noise on y.
Type | Default | Details | |
---|---|---|---|
a | float | 1.0 | Slope |
b | float | 0.5 | Intercept |
interval | list | [-10.0, 10.0] | Interval for x. |
noise | list | [0, 1e-05] | Noise [\(\mu\),\(\sigma\)] with mean \(\mu\) and standard deviation \(\sigma\) |
nsamples | int | 100 | Number of samples |
Returns | tuple | - a random x vector in the interval of size nsamples - the noisy vector following \(y= ax+b\) |
curve
curve (x, coeffs)
Create a vector following the polynomial curve \(y=w^Tx\), where \(x=(x^0...x^d)\) and \(x=(w^0...w^d)\).
Type | Details | |
---|---|---|
x | dataset to be imputed | |
coeffs | array of the weights of the polynomial of degree d-1, where d is the size of the array. | |
Returns | ndarray | the vector \(y=w \cdot x\) |
noisy_curve
noisy_curve (coeffs, x=None, interval=[-2, 2], noise=None, nsamples=100)
Create a dataset of nsamples in the interval following the polynomial curve \(y=w^Tx\), where \(x=(x^0...x^d)\) and \(x=(w^0...w^d)\) and adds a gaussian noise on y.
Type | Default | Details | |
---|---|---|---|
coeffs | array of the weights of the polynomial of degree d-1, where d is the size of the array. | ||
x | NoneType | None | dataset to be imputed. if x is None , then the dataset is constructed with nsamples from a uniform distribution |
interval | list | [-2, 2] | interval for the sampling of x |
noise | NoneType | None | tuple contining \(\mu\) and \(\sigma\). If noise is None , then there is no noise |
nsamples | int | 100 | number of samples for x |
Returns | tuple | - a random x vector in the interval of size nsamples - the noisy vector following \(y=w \cdot x\) |