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

Class Hyperplane

source code

Known Subclasses:

A structure to represent linear separations on an n-dimensional space

Instance Methods [hide private]
 
__init__(self, weights, threshold, relation=None)
Constructs a hyperplane weights*x == threshold
source code
 
getWeights(self)
Return the slope of this hyperplane
source code
 
getConstant(self) source code
boolean
test(self, value)
Returns true iff the passed in value (in array form) lies above this hyperplane (self.weights*value > self.threshold)
source code
boolean
always(self)
Returns: True: iff this plane eliminates none of the state space (i.e., for all q, w*q > theta).
source code
str
compare(self, other)
Modified version of __cmp__ method
source code
 
__str__(self) source code
 
__neg__(self) source code
Hyperplane
inverse(self)
Creates a plane exactly opposite to this one.
source code
 
__gt__(self, other) source code
 
__lt__(self, other) source code
 
__eq__(self, other) source code
 
__getitem__(self, index) source code
 
__setitem__(self, index, value) source code
 
__copy__(self) source code
 
__deepcopy__(self, memo) source code
 
__xml__(self) source code
 
parse(self, element)
Extracts the plane from the given XML element
source code
Instance Variables [hide private]
str relation
the relation against this plane.
float threshold
the offset of this plane
KeyedVector weights
the slope of this plane
Method Details [hide private]

__init__(self, weights, threshold, relation=None)
(Constructor)

source code 

Constructs a hyperplane weights*x == threshold

Parameters:
  • weights (list or array) - the slope of the hyperplane
  • threshold (float) - the intercept of this hyperplane

always(self)

source code 
Returns: boolean
  • True: iff this plane eliminates none of the state space (i.e., for all q, w*q > theta).
  • False: iff this plane eliminates all of the state space (i.e., for all q, w*q <= theta).
  • None: otherwise

Warning: This has not yet been implemented for this class

compare(self, other)

source code 

Modified version of __cmp__ method

Returns: str
  • 'less': self < other
  • 'greater': self > other
  • 'equal': self == other
  • 'indeterminate': none of the above

inverse(self)

source code 

Creates a plane exactly opposite to this one. In other words, for all x, self.test[x] implies not self.inverse().test[x]

Returns: Hyperplane

parse(self, element)

source code 

Extracts the plane from the given XML element

Parameters:
  • element (Element) - The XML Element object specifying the plane
Returns:
the Hyperplane instance

Instance Variable Details [hide private]

relation

the relation against this plane. Default is >, alternatives are: =.
Type:
str