utilities – Simple but useful Utility Functions
Tools for binary encodings
- Returns a 1-in-n binary encoding of a non-negative integer.
- Returns the reverse of a 1-in-n binary encoding.
- Returns the value of an integer in Gray encoding.
- Produces a string from an integer’s binary representation.
(preceding zeros removed).
Tools for sets
pybrain.utilities.reachable(stepFunction, start, destinations)
- Determines the subset of destinations that can be reached from a set of starting positions,
while using stepFunction (which produces a list of neighbor states) to navigate.
Uses breadth-first search.
pybrain.utilities.crossproduct(ss, row=None, level=0)
- Returns the cross-product of the sets given in ss.
- Flattens an upper triangular matrix, returning a vector of the
- Produces an upper triangular matrix of dimension dim from the elements of the given vector.
- Converts a list of matrices into a corresponding big block-diagonal one.
- Produce a matrix from a list of lists of its components.
Stochastic index choices
Draws an index given an array of probabilities.
|Key tolerant:||if set to True, the array is normalized to sum to 1.
- Return the index of the sample drawn by a softmax (Gibbs).