Package teamwork :: Package math :: Module matrices
[hide private]
[frames] | no frames]

Module matrices

source code

Base classes for piecewise linearity

Classes [hide private]
  Hyperplane
A structure to represent linear separations on an n-dimensional space
  DecisionTree
Represents a decision tree with hyperplane branches that divide an n-dimensional space, and unrestricted values stored at the leaf nodes (e.g., matrices for dynamics, actions for policies, etc.)
Functions [hide private]
 
printData(data, values=None) source code
Hyperplane[]
comparePlaneSets(set1, set2, side, comparisons=None, debug=False, negative=True)
Compares a conjunction of planes against a second conjunction of planes that has already been tested against.
source code
str{}{}
generateComparisons(set1, set2)
Pre-computes a comparison matrix between two sets of planes
source code
Variables [hide private]
boolean __CONSTANT__ = 1
flag indicating whether a constant factor should be included in each vector
float epsilon = 1e-05
margin of error used in comparison
  EMPTY_NAMESPACE = None
  EMPTY_PREFIX = None
  StringTypes = (<type 'str'>, <type 'unicode'>)
  XMLNS_NAMESPACE = 'http://www.w3.org/2000/xmlns/'
Function Details [hide private]

comparePlaneSets(set1, set2, side, comparisons=None, debug=False, negative=True)

source code 

Compares a conjunction of planes against a second conjunction of planes that has already been tested against. It prunes the current conjunction based on any redundancy or inconsistency with the test

Parameters:
  • set1 - the plane set to be pruned
  • set2 - the plane set already tested
  • side (boolean) - the side of the second set that we're already guaranteed to be on
  • negative - if True, then assume that weights may be negative (default is True
  • set1,set2 (Hyperplane[])
Returns: Hyperplane[]
The minimal set of planes in the first set that are not redundant given these a priori conditions (if guaranteed to be True or False, then the boolean value is returned)

generateComparisons(set1, set2)

source code 

Pre-computes a comparison matrix between two sets of planes

Parameters:
  • set1, set2 - the two sets of planes
  • set1,set2 (Hyperplane[])
Returns: str{}{}
a pairwise matrix of comparisons, indexed by the id of each plane, so that result[id(p1)][id(p2)] = p1.compare(p2)