surkit.data package

Submodules

surkit.data.dataset module

surkit.data.dataset.is_number(s)[source]
surkit.data.dataset.load_dataset(path, key=None)[source]

surkit.data.processing module

surkit.data.sampling module

surkit.data.sampling.get(sampler)[source]

Return a sampler based on the given string

Parameters:

sampler (str) – “random” or “uniform”

Returns:

a pre-defined sampler function

Return type:

function

surkit.data.sampling.random_sampler(lower=0, upper=1, n=1)[source]

A random sampler

Parameters:
  • lower (float | ndarray | Iterable | int | None) – lower bound

  • upper (float | ndarray | Iterable | int | None) – upper bound

  • n (int | Iterable | tuple[int] | None]) – sample size

Returns:

a set of sampling data

Return type:

numpy.ndarray

surkit.data.sampling.uniform_sampler(lower=0, upper=1, n=1)[source]

A uniform sampler

Parameters:
  • lower (float | ndarray | Iterable | int | None) – lower bound

  • upper (float | ndarray | Iterable | int | None) – upper bound

  • n (int | Iterable | tuple[int] | None]) – sample size

Returns:

a set of sampling data

Return type:

numpy.ndarray

surkit.data.sampling.weight_1d(x, xrange)[source]

Assign weight according to 1-dimensional coordinates

Parameters:
  • x (float) – value

  • xrange (list[float, float] | tuple[float, float]) – boundary

Returns:

weight

Return type:

float

surkit.data.sampling.weight_2d(x, y, xrange, yrange, dt)[source]

Assign weight according to 2-dimensional coordinates

Parameters:
  • x (float) – the value of the first dimension

  • y (float) – the value of the second dimension

  • xrange (list[float, float] | tuple[float, float]) – the boundary of the first dimension

  • yrange (list[float, float] | tuple[float, float]) – the boundary of the second dimension

  • dt (float) – empirical parameters controlling the extent of the weighted area

Returns:

weight

Return type:

float

Module contents