akro package¶
A library containing types of Spaces.

class
akro.
Space
[source]¶ Bases:
object
Provides a classification state spaces and action spaces.
Allows you to write generic code that applies to any Environment. E.g. to choose a random action.

flat_dim
¶ Return the length of the flattened vector of the space.


class
akro.
Box
(low, high, shape=None, dtype=<class 'numpy.float32'>)[source]¶ Bases:
akro.space.Space
A box in R^n.
Each coordinate is bounded above and below.

bounds
¶ Return a 2tuple containing the lower and upper bounds.

dtype
¶ Return the dtype of samples contained in this Space.

flat_dim
¶ Return the length of the flattened vector of the space.

new_tensor_variable
(name, extra_dims)[source]¶ Create a tensor variable given the name and extra dimensions.
Parameters:  name – name of the variable
 extra_dims – extra dimensions in the front
Returns: the created tensor variable

shape
¶ Return the shape of samples contained in this Space.


class
akro.
Dict
(spaces)[source]¶ Bases:
akro.space.Space
A dictionary of simpler spaces, e.g. Discrete, Box.
 Example usage:
 self.observation_space = spaces.Dict({“position”: spaces.Discrete(2),
 “velocity”: spaces.Discrete(3)})

flat_dim
¶ Return a flat dimension of the dict space.
 Returns:
 flat_dim (int)

from_jsonable
(sample_n)[source]¶ Convert information from a JSON format into a list.
 Returns:
 ret (list)

class
akro.
Discrete
(n)[source]¶ Bases:
akro.space.Space
{0,1,…,n1}.

default_value
¶ Return the default value of the spaceself.
This is always just 0.

flat_dim
¶ Return the length of the flattened vector of the space.

n
¶ Return the number of elements in the Discrete space.


class
akro.
Tuple
(*components)[source]¶ Bases:
akro.space.Space
A Tuple of Spaces which produces samples which are Tuples of samples.

components
¶ Each of the spaces making up this Tuple space.

flat_dim
¶ Return the length of the flattened vector of the space.

Subpackages¶
Submodules¶
akro.box module¶
A Space representing a rectangular region of space.

class
akro.box.
Box
(low, high, shape=None, dtype=<class 'numpy.float32'>)[source]¶ Bases:
akro.space.Space
A box in R^n.
Each coordinate is bounded above and below.

bounds
¶ Return a 2tuple containing the lower and upper bounds.

dtype
¶ Return the dtype of samples contained in this Space.

flat_dim
¶ Return the length of the flattened vector of the space.

new_tensor_variable
(name, extra_dims)[source]¶ Create a tensor variable given the name and extra dimensions.
Parameters:  name – name of the variable
 extra_dims – extra dimensions in the front
Returns: the created tensor variable

shape
¶ Return the shape of samples contained in this Space.

akro.dict module¶
Cartesian product of multiple named Spaces (also known as a dict of Spaces).
This Space produces samples which are dicts, where the values of those dicts are drawn from the values of this Space.

class
akro.dict.
Dict
(spaces)[source]¶ Bases:
akro.space.Space
A dictionary of simpler spaces, e.g. Discrete, Box.
 Example usage:
 self.observation_space = spaces.Dict({“position”: spaces.Discrete(2),
 “velocity”: spaces.Discrete(3)})

flat_dim
¶ Return a flat dimension of the dict space.
 Returns:
 flat_dim (int)

from_jsonable
(sample_n)[source]¶ Convert information from a JSON format into a list.
 Returns:
 ret (list)
akro.discrete module¶
A space representing a selection between a finite number of items.

class
akro.discrete.
Discrete
(n)[source]¶ Bases:
akro.space.Space
{0,1,…,n1}.

default_value
¶ Return the default value of the spaceself.
This is always just 0.

flat_dim
¶ Return the length of the flattened vector of the space.

n
¶ Return the number of elements in the Discrete space.

akro.space module¶
The abstract base class for all Space types.

class
akro.space.
Space
[source]¶ Bases:
object
Provides a classification state spaces and action spaces.
Allows you to write generic code that applies to any Environment. E.g. to choose a random action.

flat_dim
¶ Return the length of the flattened vector of the space.

akro.tuple module¶
Cartesian product of multiple Spaces (also known as a tuple of Spaces).
This Space produces samples which are Tuples, where the elments of those Tuples are drawn from the components of this Space.

class
akro.tuple.
Tuple
(*components)[source]¶ Bases:
akro.space.Space
A Tuple of Spaces which produces samples which are Tuples of samples.

components
¶ Each of the spaces making up this Tuple space.

flat_dim
¶ Return the length of the flattened vector of the space.
