Data Source (Implementation)

Contents

Data Source (Implementation)#

alts.modules.oracle.data_source
class BrownianDriftDataSource(reinit, query_shape, result_shape, kern, support_points, brown_var, rbf_var, rbf_leng, min_support, max_support)[source]#

Bases: GaussianProcessDataSource

Description
A BrownianDriftDataSource is a function-prior random source of data interpolating between random data points using a linear function y=ab+a where a is a RBF Kernel and b is a Brownian Kernel.
Parameters:
  • reinit (bool) – If the DataSource should re-initiate its singleton (default= False)

  • query_shape (tuple of ints) – The expected shape of the queries (default= (2,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • kern (GPy.kern.Kern) – The kernel to use for the gaussian process (invariably set to GPy.Kern.Brownian)

  • support_points (int) – The amount of data points to interpolate between in the gaussian process. (default= 2000)

  • brown_var (float) – The variance of the brownian motion (default= 0.01)

  • rbf_var (float) – The variance of the Radial Basis Function (default= 0.25)

  • rbf_leng (float) – The smoothness of the function, where higher values correspond to higher smoothness (default= 0.1)

  • min_support (tuple of floats) – The lowest permitted query value for each support (default= (0,))

  • max_support (tuple of floats) – The highest permitted query value for each support (default= (100,))

brown_var: float = 0.01#
max_support: Tuple[float, ...] = (2000, 1)#
min_support: Tuple[float, ...] = (0, -1)#
post_init(self) None[source]#
Description
Assigns a Brownian_Kernel*RBF_Kernel+RBF_Kernel to itself.
Initializes its Singleton.
See init_singleton() for more.
query_shape: Tuple[int, ...] = (2,)#
rbf_leng: float = 0.1#
rbf_var: float = 0.25#
result_shape: Tuple[int, ...] = (1,)#
class BrownianProcessDataSource(reinit, query_shape, result_shape, kern, support_points, min_support, max_support, brown_var)[source]#

Bases: GaussianProcessDataSource

Description
A BrownianProcessDataSource is a function-prior random source of data interpolating between random data points using Brownian Motion.
Parameters:
  • reinit (bool) – If the DataSource should re-initiate its singleton (default= False)

  • query_shape (tuple of ints) – The expected shape of the queries (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • kern (GPy.kern.Kern) –

    The kernel to use for the gaussian process (invariably set to GPy.Kern.Brownian)

  • support_points (int) – The amount of data points to interpolate between in the gaussian process. (default= 2000)

  • min_support (tuple of floats) – The lowest permitted query value for each support (default= (0,))

  • max_support (tuple of floats) – The highest permitted query value for each support (default= (100,))

  • brown_var (float) – The variance of the brownian motion (default= 0.01)

brown_var: float = 0.01#
max_support: Tuple[float, ...] = (100,)#
min_support: Tuple[float, ...] = (0,)#
post_init(self) None[source]#
Description
Assigns a Brownian Kernel to itself.
Initializes its Singleton.
See init_singleton() for more.
query_shape: Tuple[int, ...] = (1,)#
result_shape: Tuple[int, ...] = (1,)#
class CrossDataSource(query_shape, result_shape, a)[source]#

Bases: DataSource

Description
A CrossDataSource is a function-prior 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 (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • a (float) – Coefficient of x (default= 1)

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

queries (NDArray) – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) 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(self) 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(query_shape, result_shape, a, s)[source]#

Bases: DataSource

Description
A DoubleLinearDataSource is a function-prior 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 (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • a (float) – Coefficient of x (default= 1)

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

a: float = 1#
query(self, queries) data_points[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
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(self) 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(query_shape, result_shape, b, s)[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 (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • b (float) – Basis to the exponent x (default= 2)

  • s (float) – Coefficient of base^x (default= 1)

b: float = 2#
query(self, queries) data_points[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
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(self) 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

NaN

s

s

s

s * b

s < 0

NaN

s

s * b

s

s

s = 0

NaN

0

0

0

0

s = 0

NaN

0

0

0

0

s >= 0

NaN

0

s * b

s

s

s >= 0

NaN

s

s

s

s * b

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
s: float = 1#
class GaussianProcessDataSource(reinit, query_shape, result_shape, kern, support_points, min_support, max_support)[source]#

Bases: DataSource

Description
A GaussianProcessDataSource is a function-prior random source of data interpolating between random data points using Gaussian Process Regression.
Parameters:
  • reinit (bool) – If the DataSource should re-initiate its singleton (default= False)

  • query_shape (tuple of ints) – The expected shape of the queries (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • kern (GPy.kern.Kern) –

    The kernel to use for the gaussian process (default=GPy.Kern.RBF “Radial Basis Function”)

  • support_points (int) – The amount of data points to interpolate between in the gaussian process. (default= 2000)

  • min_support (tuple of floats) – The lowest permitted query value for each support (default= (-1,))

  • max_support (tuple of floats) – The highest permitted query value for each support (default= (1,))

init_singleton(self) None[source]#
Description
Initializes the Gaussian Process Regression with random values within the given restrictions.
kern: GPy.kern.Kern | None = None#
max_support: Tuple[float, ...] = (1,)#
min_support: Tuple[float, ...] = (-1,)#
post_init(self) None[source]#
Description
Assigns a RBF Kernel to itself if it has not been assigned one already.
Initializes its Singleton.
See init_singleton() for more.
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
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [min_support, max_support)
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(query_shape, result_shape, a)[source]#

Bases: DataSource

Description
A HourglassDataSource is a function-prior 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 (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • a (float) – Coefficient of x (default= 1)

a: float = 1#
query(self, queries) data_points[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
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(self) 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

HypersphereDataSource(query_shape, result_shape) | Description | A HypersphereDataSource is a function-prior random source of data choosing one of the following equations at random {-sqrt(abs(1-x²)), sqrt(abs(1-x²))}.

Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

query(self, queries) data_points[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
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [-1, 1)
Returns:

Constrains around queries

Return type:

QueryConstrain

query_shape: Tuple[int, ...] = (1,)#
result_shape: Tuple[int, ...] = (1,)#
class HypercubeDataSource(query_shape, result_shape, w)[source]#

Bases: DataSource

Description
A HypercubeDataSource is a function-prior random source of data choosing for x in [-w,w) one of the following values at random {-0.5 , 0.5} and else a random value in [-0.5 , 0.5).
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • w (float) – Outside what range [-w, w) to break down into randomness (default= 0.4)

query(self, queries) data_points[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
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_shape: Tuple[int, ...] = (1,)#
w: float = 0.4#
class IndependentDataSource(reinit, query_shape, result_shape, number_of_distributions, all_distributions, distributions, coefficients)[source]#

Bases: DataSource

Description
An IndependentDataSource is an independent source of data randomly choosing between multiple random distributions to randomly choose from.
Parameters:
  • reinit (bool) – If the DataSource should re-initiate its singleton (default= False)

  • query_shape (tuple of ints) – The expected shape of the queries (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • number_of_distributions (int) – The amount of data distributions to choose from (default= 20)

  • all_distributions (Tuple) – A tuple of all differen distributions to choose from (default= (np.random.normal,np.random.uniform,np.random.gamma))

  • distributions (list) – A list of all number_of_distributions many distributions (default= random)

  • coefficients (NDArray[Shape['D'], Number]) – The likelihood for each distribution to be chosen (default= random)

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(self) None[source]#
Description
Initializes the distributions with random values within the given restrictions.
number_of_distributions: int = 20#
post_init(self) None[source]#
Description
Initializes its Singleton.
See init_singleton() for more.
query(self, queries) data_points[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
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,)#
reinit: bool = False#
result_shape: Tuple[int, ...] = (1,)#
class InterpolatingDataSource(data_sampler, interpolation_strategy)[source]#

Bases: DataSource

Description
An InterpolatingDataSource is an independent source of data depending on the DataSource it interpolates within.
Parameters:
  • data_sampler (DataSampler) – The data sampler to sample data for interpolation

  • interpolation_strategy (InterpolationStrategy) – The interpolation strategy for the data points

data_sampler: DataSampler = NOTSET#
interpolation_strategy: InterpolationStrategy = NOTSET#
post_init(self) None[source]#
Description
Initializes its DataSampler and InterpolationStrategy.
query(self, queries) data_points[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
See DataSource.query_constrain()
Returns:

Constrains around queries

Return type:

QueryConstrain

class LineDataSource(query_shape, result_shape, a, b)[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 (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • a (float (optional)) – Coefficient of degree 1, (default= 1)

  • b (float (optional)) – Coefficient of degree 0, (default= 0)

a: float = 1#
b: float = 0#
query(self, queries) data_points[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
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(self) 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(query_shape, result_shape, a, p)[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 (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • a (float) – Coefficient of x (default= 1)

  • p (float) – Modulo divisor (default= 0.2)

a: float = 1#
p: float = 0.2#
query(self, queries) data_points[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
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(self) 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

NaN

NaN

NaN

p = 0

NaN

NaN

NaN

p > 0

0

0

0

p > 0

p

0

p

Returns:

Constrains around results

Return type:

ResultConstrain

result_shape: Tuple[int, ...] = (1,)#
class LinearStepDataSource(query_shape, result_shape, a, p)[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 (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • a (float) – Coefficient of x (default= 1)

  • p (float) – Integer divisor (default= 0.2)

a: float = 1#
p: float = 0.2#
query(self, queries) data_points[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
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(self) 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

NaN

NaN

NaN

p = 0

NaN

NaN

NaN

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

MixedDriftDataSource(support_points, reinit, query_shape, result_shape, brown_var, rbf_var, rbf_leng, min_support, max_support) | Description | A MixedDriftDataSource is a function-prior random source of data interpolating data points with a linear combination of RBF, Brownian and Cosine kernels and Brownian Drift.

Parameters:
  • support_points (int) – The amount of data points to interpolate between in the gaussian process. (default= 2000)

  • reinit (bool) – If the DataSource should re-initiate its singleton (default= False)

  • query_shape (tuple of ints) – The expected shape of the queries (default= (2,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • brown_var (float) – The variance of the brownian motion (default= 0.01)

  • rbf_var (float) – The variance of the Radial Basis Function (default= 0.25)

  • rbf_leng (float) – The smoothness of the function, where higher values correspond to higher smoothness (default= 0.1)

  • min_support (tuple of floats) – The lowest permitted query value for each support (default= (0, -1))

  • max_support (tuple of floats) – The highest permitted query value for each support (default= (2000, 1))

brown_var: float = 0.01#
max_support: Tuple[float, ...] = (2000, 1)#
min_support: Tuple[float, ...] = (0, -1)#
post_init(self) None[source]#
Description
Initializes its 7 kernels.
Initializes its Singleton.
See init_singleton() for more.
query(self, queries) data_points[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
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [min_support, max_support)
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(support_points, reinit, query_shape, result_shape, brown_var, rbf_var, rbf_leng, min_support, max_support)[source]#

Bases: GaussianProcessDataSource

Description
A MixedDriftDataSource is a function-prior random source of data interpolating data points with a linear combination of RBF, Brownian and Cosine kernels and RBF drift.
Parameters:
  • support_points (int) – The amount of data points to interpolate between in the gaussian process. (default= 2000)

  • reinit (bool) – If the DataSource should re-initiate its singleton (default= False)

  • query_shape (tuple of ints) – The expected shape of the queries (default= (2,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • brown_var (float) – The variance of the brownian motion (default= 0.01)

  • rbf_var (float) – The variance of the Radial Basis Function (default= 0.25)

  • rbf_leng (float) – The smoothness of the function, where higher values correspond to higher smoothness (default= 0.1)

  • min_support (tuple of floats) – The lowest permitted query value for each support (default= (0, -1))

  • max_support (tuple of floats) – The highest permitted query value for each support (default= (2000, 1))

brown_var: float = 0.01#
max_support: Tuple[float, ...] = (2000, 1)#
min_support: Tuple[float, ...] = (0, -1)#
post_init(self) None[source]#
Description
Initializes its 7 kernels.
Initializes its Singleton.
See init_singleton() for more.
query(self, queries) data_points[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
See DataSource.query_constrain()
Current Constrains
Shape: query_shape
Value Range: [min_support, max_support)
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(query_shape, result_shape, p, s)[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 (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • p (float) – Power of x (default= 3)

  • s (float) – Coefficient of x^power (default= 1)

p: float = 3#
query(self, queries) data_points[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
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(self) 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(reinit, query_shape, result_shape, kern, support_points, brown_var, rbf_var, rbf_leng, min_support, max_support)[source]#

Bases: GaussianProcessDataSource

Description
A RBFDriftDataSource is a function-prior random source of data interpolating with a RBF kernel with RBF drift.
Parameters:
  • reinit (bool) – If the DataSource should re-initiate its singleton (default= False)

  • query_shape (tuple of ints) – The expected shape of the queries (default= (2,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • kern (GPy.kern.Kern) –

    The kernel to use for the gaussian process (invariably set to GPy.Kern.Brownian)

  • support_points (int) – The amount of data points to interpolate between in the gaussian process. (default= 2000)

  • brown_var (float) – The variance of the brownian motion (default= 0.01)

  • rbf_var (float) – The variance of the Radial Basis Function (default= 0.25)

  • rbf_leng (float) – The smoothness of the function, where higher values correspond to higher smoothness (default= 0.1)

  • min_support (tuple of floats) – The lowest permitted query value for each support (default= (0, -1))

  • max_support (tuple of floats) – The highest permitted query value for each support (default= (2000, 1))

brown_var: float = 0.01#
max_support: Tuple[float, ...] = (2000, 1)#
min_support: Tuple[float, ...] = (0, -1)#
post_init(self) None[source]#
Description
Initializes its Kernel.
Initializes its Singleton.
See init_singleton() for more.
query_shape: Tuple[int, ...] = (2,)#
rbf_leng: float = 0.1#
rbf_var: float = 0.25#
result_shape: Tuple[int, ...] = (1,)#
class RandomUniformDataSource(query_shape, result_shape, u, l)[source]#

Bases: DataSource

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

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • u (float) – The upper bound of query values (exclusive) (default= 1)

  • l (float) – The lower bound of query values (inclusive), (default= 0)

l: float = 0#
query(self, queries) data_points[source]#
Description
Each query receives a uniformly random result in [l, u).
Parameters:

queries – Requested Query

Returns:

Processed Query, Result

Return type:

A tuple of two NDArray

query_constrain(self) 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(self) 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(reinit, query_shape, result_shape, kern, support_points, brown_var, rbf_var, rbf_leng, min_support, max_support)[source]#

Bases: GaussianProcessDataSource

Description
A SinDriftDataSource is a function-prior random source of data interpolating data points with a cosine kernel with rbf drift.
Parameters:
  • reinit (bool) – If the DataSource should re-initiate its singleton (default= False)

  • query_shape (tuple of ints) – The expected shape of the queries (default= (2,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • kern (GPy.kern.Kern) –

    The kernel to use for the gaussian process (invariably set to GPy.Kern.Brownian)

  • support_points (int) – The amount of data points to interpolate between in the gaussian process. (default= 2000)

  • brown_var (float) – The variance of the brownian motion (default= 0.01)

  • rbf_var (float) – The variance of the Radial Basis Function (default= 0.25)

  • rbf_leng (float) – The smoothness of the function, where higher values correspond to higher smoothness (default= 0.1)

  • min_support (tuple of floats) – The lowest permitted query value for each support (default= (0, -1))

  • max_support (tuple of floats) – The highest permitted query value for each support (default= (2000, 1))

brown_var: float = 0.005#
max_support: Tuple[float, ...] = (2000, 1)#
min_support: Tuple[float, ...] = (0, -1)#
post_init(self) None[source]#
Description
Initializes its Kernel.
Initializes its Singleton.
See init_singleton() for more.
query_shape: Tuple[int, ...] = (2,)#
rbf_leng: float = 0.1#
rbf_var: float = 0.25#
result_shape: Tuple[int, ...] = (1,)#
class SineDataSource(query_shape, result_shape, a, p)[source]#

Bases: DataSource

Description
A SineDataSource is a deterministic source of data representing the equation sin((x-x0)*2pi*p) + y0.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • a (float) – Coefficient of x (default= 1)

  • p (float) – Integer divisor (default= 0.2)

a: float = 1#
p: float = 1#
query(self, queries) data_points[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
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_shape: Tuple[int, ...] = (1,)#
x0: float = 0#
y0: float = 0#
class SquareDataSource(query_shape, result_shape, x0, y0, s)[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 (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

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

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

  • s (float (optional)) – Coefficient of degree 2, (default= 5)

query(self, queries) data_points[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
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(self) ResultConstrain[source]#
Description
See DataSource.result_constrain()
Current Constrains
Shape: result_shape
Value Range:

MIN

s < 0

s >= 0

MAX

s < 0

s >= 0

x0 < 0

s*x0^2+y0

y0

x0 < 0

s*x0^2+y0

s*(1-x0)^2+y0

0 <= x0 < 0.5

N/A

N/A

0 <= x0 < 0.5

y0

s*(1-x0)^2+y0

0.5 <= x0 < 1

N/A

N/A

0.5 <= x0 < 1

y0

s*x0^2+y0

1 <= x0

N/A

N/A

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(query_shape, result_shape, w)[source]#

Bases: DataSource

Description
A StarDataSource is a function-prior random source of data choosing for x in [-w,w) a random value in [-0.5 , 0.5) and else one of the following equations at random {-x , 0, x}.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • w (float) – Inside what range [-w, w) to break down into randomness (default= 0.0.05)

query(self, queries) data_points[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
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_shape: Tuple[int, ...] = (1,)#
w: float = 0.05#
class TimeBehaviorDataSource(query_shape, result_shape, behavior, change_times, change_values, current_time)[source]#

Bases: TimeDataSource

Description
A TimeBehaviorDataSource is an independent source of data depending on the DataBehavior over time.
Parameters:
  • query_shape (tuple of ints) – The expected shape of the queries (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • behavior (DataBehavior) – How the data behaves over time

  • change_times (NDArray[Shape["change_times"], Number]) – At what times data behavior changes

  • change_values (NDArray[Shape["change_values"], Number]) – How the values change at the given times

  • current_time (float) – Current (or starting) time in the experiment (default= 0)

behavior: DataBehavior = NOTSET#
change_times: NDArray[Shape['change_times'], Number]#
change_values: NDArray[Shape['change_values'], Number]#
current_time: float = 0#
property exhausted#
Description
True if current time has exceeded the data source’s stop time.
Returns:

Exhausted or not

Return type:

bool

post_init(self) None[source]#
Description
Initializes its Singleton.
See init_singleton() for more.
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(query_shape, result_shape, a)[source]#

Bases: DataSource

Description
A ZDataSource is a function-prior 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 (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • a (float) – Coefficient of x (default= 1)

a: float = 1#
query(self, queries) data_points[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
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(query_shape, result_shape, a)[source]#

Bases: DataSource

Description
A ZInvDataSource is a function-prior 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 (default= (1,))

  • result_shape (tuple of ints) – The expected shape of the results (default= (1,))

  • a (float) – Coefficient of x (default= 1)

a: float = 1#
query(self, queries) data_points[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
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(self) 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,)#