coopihc.base.Space.Space
- class Space(low=None, high=None, array=None, N=None, _function=None, seed=None, dtype=None, contains='numpy')[source]
Bases:
object
_summary_
- Parameters
low (see Numeric<coopihc.base.Space.Numeric>, optional) – see Numeric<coopihc.base.Space.Numeric>, defaults to None
high (see Numeric<coopihc.base.Space.Numeric>, optional) – see Numeric<coopihc.base.Space.Numeric>, defaults to None
array (see CatSet<coopihc.base.Space.CatSet>, optional) – see CatSet<coopihc.base.Space.CatSet>, defaults to None
N (for future, optional) – for future, defaults to None
_function (for future, optional) – for future, defaults to None
- Returns
A CoopIHC space
- Return type
Numeric<coopihc.base.Space.Numeric> or CatSet<coopihc.base.Space.CatSet>
Methods
Computes the cartesian product of the spaces provided in input.
- static cartesian_product(*spaces)[source]
Computes the cartesian product of the spaces provided in input. For this method, continuous spaces are treated as singletons {None}.
s = space(array=numpy.array([1, 2, 3], dtype=numpy.int16)) q = space(array=numpy.array([-3, -2, -1], dtype=numpy.int16)) cp, shape = cartesian_product(s, q) assert ( cp == numpy.array( [ [1, -3], [1, -2], [1, -1], [2, -3], [2, -2], [2, -1], [3, -3], [3, -2], [3, -1], ] ) ).all()
- Returns
cartesian product and shape of associated spaces
- Return type
tuple(numpy.ndarray, list(tuples))