boofun.core.spaces

Classes

Space(value)

class boofun.core.spaces.Space(value)[source]
BOOLEAN_CUBE = 1
PLUS_MINUS_CUBE = 2
REAL = 3
LOG = 4
GAUSSIAN = 5
static translate(input: int | float | ndarray, source_space: Space, target_space: Space) int | float | ndarray[source]

Translate a scalar or array from one space to another.

Parameters:
  • input – Input value(s) to translate

  • source_space – Source mathematical space

  • target_space – Target mathematical space

Returns:

Translated value(s) in target space

Examples

>>> Space.translate([0, 1], Space.BOOLEAN_CUBE, Space.PLUS_MINUS_CUBE)
array([-1,  1])
>>> Space.translate([-1, 1], Space.PLUS_MINUS_CUBE, Space.BOOLEAN_CUBE)
array([0, 1])
static get_canonical_space() Space[source]

Get the canonical space for internal computations.

static is_discrete(space: Space) bool[source]

Check if space uses discrete values.

static is_continuous(space: Space) bool[source]

Check if space uses continuous values.

static get_default_threshold(space: Space) float[source]

Get default threshold for converting continuous to discrete.