Data Source (Implementation) [80%]

Contents

Data Source (Implementation) [80%]#

alts.modules.oracle.data_source
class BrownianDriftDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: GaussianProcessDataSource

brown_var: float = 0.01#
max_support: Tuple[float, ...] = (2000, 1)#
min_support: Tuple[float, ...] = (0, -1)#
post_init(self) None[source]#
Description
Runs after __post_init__, does nothing here.
query_shape: Tuple[int, ...] = (2,)#
rbf_leng: float = 0.1#
rbf_var: float = 0.25#
result_shape: Tuple[int, ...] = (1,)#
class BrownianProcessDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: GaussianProcessDataSource

brown_var: float = 0.01#
max_support: Tuple[float, ...] = (100,)#
min_support: Tuple[float, ...] = (0,)#
post_init(self) None[source]#
Description
Runs after __post_init__, does nothing here.
query_shape: Tuple[int, ...] = (1,)#
result_shape: Tuple[int, ...] = (1,)#
class CrossDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
A CrossDataSource is a semi-random source of data choosing one of the following equations at random {-a * x, a * x}.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • a (float) – Coefficient of x

a: float = 1#
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries (NDArray) – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain() QueryConstrain[source]#
Description
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [-0.5, 0.5)
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

a < 0

a = 0

a > 0

MAX

a < 0

a = 0

a > 0

1/4*a

0

-1/4*a

-1/4*a

0

1/4*a

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
class DoubleLinearDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
A DoubleLinearDataSource is a semi-random source of data choosing one of the following equations at random {a * x, a * x * s}.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • a (float) – Coefficient of x

  • s (float) – Coefficient that is randomly in- or excluded

a: float = 1#
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain() QueryConstrain[source]#
Description
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [-0.5, 0.5)
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

a < 0

a >= 0

MAX

a < 0

a >= 0

s < -1

-1/2*a*s

1/2*a*s

s < -1

1/2*a*s

-1/2*a*s

-1 <= s < 1

1/2*a

-1/2*a

-1 <= s < 1

-1/2*a

1/2*a

1 <= s

1/2*a*s

-1/2*a*s

1 <= s

-1/2*a*s

1/2*a*s

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
s: float = 0.5#
class ExpDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
An ExpDataSource is a deterministic source of data representing an exponential equation s * b^x.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • b (float) – Basis to the exponent x

  • s (float) – Coefficient of base^x

b: float = 2#
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain() QueryConstrain[source]#
Description
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [0, 1)
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

b < 0

b = 0

0 <= b < 1

b = 1

b > 1

MAX

b < 0

b = 0

0 <= b < 1

b = 1

b > 1

s < 0

N/A

s

s

s

s * b

s < 0

N/A

s

s * b

s

s

s = 0

N/A

0

0

0

0

s = 0

N/A

0

0

0

0

s >= 0

N/A

0

s * b

s

s

s >= 0

N/A

s

s

s

s * b

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
s: float = 1#
class GaussianProcessDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: DataSource

init_singleton()[source]#
kern: GPy.kern.Kern | None = None#
max_support: Tuple[float, ...] = (1,)#
min_support: Tuple[float, ...] = (-1,)#
post_init(self) None[source]#
Description
Runs after __post_init__, does nothing here.
query(queries) Tuple[NDArray[Shape['query_nr, ... query_dim'], Number], NDArray[Shape['query_nr, ... result_dim'], Number]][source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) QueryConstrain[source]#
Description
query_constrain() is a getter-function for the constrains around queries to the DataSource.
Constrains can affect the count, shape and the ranges of a query.
For more information, see Constrains
Current Constrains
Shape: query_shape
Value Range: (-inf, inf) for all values
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
regression: GPy.models.GPRegression = None#
reinit: bool = False#
result_shape: Tuple[int, ...] = (1,)#
support_points: int = 2000#
class HourglassDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
A HourglassDataSource is a semi-random source of data choosing one of the following equations at random {a * x, -a * x , -a/2, a/2}.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • a (float) – Coefficient of x

a: float = 1#
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain() QueryConstrain[source]#
Description
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [0, 1)
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

a < 0

a >= 0

MAX

a < 0

a >= 0

1/2*a

-1/2*a

-1/2*a

1/2*a

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
class HyperSphereDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: DataSource

query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) QueryConstrain[source]#
Description
query_constrain() is a getter-function for the constrains around queries to the DataSource.
Constrains can affect the count, shape and the ranges of a query.
For more information, see Constrains
Current Constrains
Shape: query_shape
Value Range: (-inf, inf) for all values
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_shape: Tuple[int, ...] = (1,)#
class HypercubeDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: DataSource

query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) QueryConstrain[source]#
Description
query_constrain() is a getter-function for the constrains around queries to the DataSource.
Constrains can affect the count, shape and the ranges of a query.
For more information, see Constrains
Current Constrains
Shape: query_shape
Value Range: (-inf, inf) for all values
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_shape: Tuple[int, ...] = (1,)#
w: float = 0.4#
class IndependentDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: DataSource

all_distributions: Tuple = (<built-in method normal of numpy.random.mtrand.RandomState object>, <built-in method uniform of numpy.random.mtrand.RandomState object>, <built-in method gamma of numpy.random.mtrand.RandomState object>)#
coefficients: NDArray[Shape['D'], Number] = None#
distributions: list = None#
init_singleton()[source]#
number_of_distributions: int = 20#
post_init(self) None[source]#
Description
Runs after __post_init__, does nothing here.
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) QueryConstrain[source]#
Description
query_constrain() is a getter-function for the constrains around queries to the DataSource.
Constrains can affect the count, shape and the ranges of a query.
For more information, see Constrains
Current Constrains
Shape: query_shape
Value Range: (-inf, inf) for all values
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
reinit: bool = False#
result_shape: Tuple[int, ...] = (1,)#
class InterpolatingDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
An InterpolatingDataSource is an ambivalent source of data depending on the DataSource it interpolates within.
Parameters:
  • data_sampler (tuple of) – The data sample to interpolate within

  • interpolation_strategy (tuple of ints) – The expected shape of the results

data_sampler: DataSampler = NOTSET#
interpolation_strategy: InterpolationStrategy = NOTSET#
post_init()[source]#
Description
Post-initialisation of the instance
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain() QueryConstrain[source]#
Description
See DataSource.query_constrain()
Returns:

Constrains around queries

Return type:

QueryConstrain

class LineDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
A LineDataSource is a deterministic source of data representing a linear equation y = ax + b.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • a (float (optional)) – Coefficient of degree 1, defaults to 1

  • b (float (optional)) – Coefficient of degree 0, defaults to 0

a: float = 1#
b: float = 0#
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain() QueryConstrain[source]#
Description
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [0, 1)
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

a < 0

a >= 0

MAX

a <= 0

a > 0

a + b

b

b

a + b

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
class LinearPeriodicDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
A LinearPeriodicDataSource is a deterministic source of data representing the equation a*x mod p.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • a (float) – Coefficient of x

  • p (float) – Modulo divisor

a: float = 1#
p: float = 0.2#
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) QueryConstrain[source]#
Description
query_constrain() is a getter-function for the constrains around queries to the DataSource.
Constrains can affect the count, shape and the ranges of a query.
For more information, see Constrains
Current Constrains
Shape: query_shape
Value Range: (-inf, inf) for all values
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

a < 0

a = 0

a > 0

MAX

a < 0

a = 0

a > 0

p < 0

p

0

p

p < 0

0

0

0

p = 0

N/A

N/A

N/A

p = 0

N/A

N/A

N/A

p > 0

0

0

0

p > 0

p

0

p

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
class LinearStepDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
A LinearStepDataSource is a deterministic source of data representing the equation a*(x-mod(x,p))/p.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • a (float) – Coefficient of x

  • p (float) – Integer divisor

a: float = 1#
p: float = 0.2#
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) QueryConstrain[source]#
Description
query_constrain() is a getter-function for the constrains around queries to the DataSource.
Constrains can affect the count, shape and the ranges of a query.
For more information, see Constrains
Current Constrains
Shape: query_shape
Value Range: (-inf, inf) for all values
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

a < 0

a = 0

a > 0

MAX

a < 0

a = 0

a > 0

p < 0

0

0

a*floor(1/p)

p < 0

a*floor(1/p)

0

0

p = 0

N/A

N/A

N/A

p = 0

N/A

N/A

N/A

p > 0

a*floor(1/p)

0

0

p > 0

0

0

a*floor(1/p)

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
class MixedBrownDriftDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: GaussianProcessDataSource

brown_var: float = 0.01#
max_support: Tuple[float, ...] = (2000, 1)#
min_support: Tuple[float, ...] = (0, -1)#
post_init(self) None[source]#
Description
Runs after __post_init__, does nothing here.
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) QueryConstrain[source]#
Description
query_constrain() is a getter-function for the constrains around queries to the DataSource.
Constrains can affect the count, shape and the ranges of a query.
For more information, see Constrains
Current Constrains
Shape: query_shape
Value Range: (-inf, inf) for all values
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (2,)#
rbf_leng: float = 0.1#
rbf_var: float = 0.25#
reinit: bool = False#
result_shape: Tuple[int, ...] = (1,)#
support_points: int = 2000#
class MixedDriftDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: GaussianProcessDataSource

brown_var: float = 0.01#
max_support: Tuple[float, ...] = (2000, 1)#
min_support: Tuple[float, ...] = (0, -1)#
post_init(self) None[source]#
Description
Runs after __post_init__, does nothing here.
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) QueryConstrain[source]#
Description
query_constrain() is a getter-function for the constrains around queries to the DataSource.
Constrains can affect the count, shape and the ranges of a query.
For more information, see Constrains
Current Constrains
Shape: query_shape
Value Range: (-inf, inf) for all values
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (2,)#
rbf_leng: float = 0.1#
rbf_var: float = 0.25#
reinit: bool = False#
result_shape: Tuple[int, ...] = (1,)#
support_points: int = 2000#
class PowDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
A PowDataSource is a deterministic source of data representing an exponential equation s * x^p.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • p (float) – Power of x

  • s (float) – Coefficient of x^power

p: float = 3#
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain() QueryConstrain[source]#
Description
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [0, 1)
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

p < 0

p = 0

p > 0

MAX

p < 0

p = 0

p > 0

s < 0

-inf

s

s

s < 0

s

s

0

s >= 0

s

s

0

s >= 0

inf

s

s

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
s: float = 1#
class RBFDriftDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: GaussianProcessDataSource

brown_var: float = 0.01#
max_support: Tuple[float, ...] = (2000, 1)#
min_support: Tuple[float, ...] = (0, -1)#
post_init(self) None[source]#
Description
Runs after __post_init__, does nothing here.
query_shape: Tuple[int, ...] = (2,)#
rbf_leng: float = 0.1#
rbf_var: float = 0.25#
result_shape: Tuple[int, ...] = (1,)#
class RandomUniformDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
A RandomUniformDataSource is a random source of data.
For more details see numpy.random.uniorm.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • u (float (optional)) – The upper bound of query values (exclusive), defaults to 1

  • l (float (optional)) – The lower bound of query values (inclusive), defaults to 0

l: float = 0#
query(queries)[source]#
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain() QueryConstrain[source]#
Description
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [0, 1)
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range: [l, u)
Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
u: float = 1#
class SinDriftDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: GaussianProcessDataSource

brown_var: float = 0.005#
max_support: Tuple[float, ...] = (2000, 1)#
min_support: Tuple[float, ...] = (0, -1)#
post_init(self) None[source]#
Description
Runs after __post_init__, does nothing here.
query_shape: Tuple[int, ...] = (2,)#
rbf_leng: float = 0.1#
rbf_var: float = 0.25#
result_shape: Tuple[int, ...] = (1,)#
class SineDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: DataSource

a: float = 1#
p: float = 1#
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) QueryConstrain[source]#
Description
query_constrain() is a getter-function for the constrains around queries to the DataSource.
Constrains can affect the count, shape and the ranges of a query.
For more information, see Constrains
Current Constrains
Shape: query_shape
Value Range: (-inf, inf) for all values
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_shape: Tuple[int, ...] = (1,)#
x0: float = 0#
y0: float = 0#
class SquareDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
A SquareDataSource is a deterministic source of data representing a square parabola s * (x - x0)^2 + y0.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • x0 (float (optional)) – Offset of the parabola in x-direction, defaults to 0.5

  • y0 (float (optional)) – Offset of the parabola in y-direction, defaults to 0

  • s (float (optional)) – Coefficient of degree 2, defaults to 5

query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain() QueryConstrain[source]#
Description
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [0, 1)
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

s < 0

s >= 0

MAX

s < 0

s >= 0

s*x0^2+y0

y0

x0 < 0

s*x0^2+y0

s*(1-x0)^2+y0

0 <= x0 < 0.5

y0

s*(1-x0)^2+y0

0.5 <= x0 < 1

y0

s*x0^2+y0

1 <= x0

s*(1-x0)^2+y0

s*x0^2+y0

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
s: float = 5#
x0: float = 0.5#
y0: float = 0#
class StarDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: DataSource

query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) QueryConstrain[source]#
Description
query_constrain() is a getter-function for the constrains around queries to the DataSource.
Constrains can affect the count, shape and the ranges of a query.
For more information, see Constrains
Current Constrains
Shape: query_shape
Value Range: (-inf, inf) for all values
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_shape: Tuple[int, ...] = (1,)#
w: float = 0.05#
class TimeBehaviorDataSource(*args: 'Any', **kwargs: 'Any')[source]#

Bases: TimeDataSource

behavior: DataBehavior = NOTSET#
change_times: NDArray[Shape['change_times'], Number]#
change_values: NDArray[Shape['change_values'], Number]#
current_time: float = 0#
property exhausted#
Description
A DataSource is exhausted if all its available data has been querried.
Returns False by default
Returns:

Whether the DataSource has been exhausted

Return type:

boolean

post_init(self) None[source]#
Description
Runs after __post_init__, does nothing here.
query(queries: NDArray[Shape['query_nr, ... query_dim'], Number]) Tuple[NDArray[Shape['query_nr, ... query_dim'], Number], NDArray[Shape['query_nr, ... result_dim'], Number]][source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_shape: Tuple[int, ...] = (1,)#
result_shape: Tuple[int, ...] = (1,)#
class ZDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
A ZDataSource is a semi-random source of data choosing one of the following equations at random {a * x , -a/2, a/2}.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • a (float) – Coefficient of x

a: float = 1#
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain() QueryConstrain[source]#
Description
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [0, 1)
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

a < 0

a >= 0

MAX

a < 0

a >= 0

1/2*a

-1/2*a

-1/2*a

1/2*a

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
class ZInvDataSource(*args: Any, **kwargs: Any)[source]#

Bases: DataSource

Description
A ZInvDataSource is a semi-random source of data choosing one of the following equations at random {-a * x , -a/2, a/2}.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries

  • result_shape (tuple of ints) – The expected shape of the results

  • a (float) – Coefficient of x

a: float = 1#
query(queries)[source]#
Description
See DataSource.query()
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain() QueryConstrain[source]#
Description
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [0, 1)
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_constrain() ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

a < 0

a >= 0

MAX

a < 0

a >= 0

1/2*a

-1/2*a

-1/2*a

1/2*a

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#