ecologylab.generic
Interface IFeatureVector<T>

All Known Implementing Classes:
FeatureVector

public interface IFeatureVector<T>


Field Summary
static HashMapPool HASH_MAP_POOL
           
 
Method Summary
 int commonDimensions(IFeatureVector<T> v)
          Returns the number of common elements in this vector and the passed in vector
 double dot(IFeatureVector<T> v)
          Calculates the dot product of this vector with another vector.
 double dotSimplex(IFeatureVector<T> v)
          Returns the dot product of this vector and the simplex of the passed in vector.

You can the average value of all the elements in this vector which are common to both by dividing this result by the commonDimensions.
 java.util.Set<T> elements()
          The set of elements which have some value associated with them in this FeatureVector.
By convention, this set is not backed by the FeatureVector so it may be modified without consequence.

Other implementations should try to follow this convention as well.
 double get(T term)
           
 java.util.Map<T,java.lang.Double> map()
          A reference to the underlying Map backing this vector
 double max()
          Returns the value in the vector with the largest magnitude.
 double norm()
          Calculates the Euclidean norm/length of this vector.
 IFeatureVector<T> simplex()
          Creates a new vector with the same elements as this vector, setting all the values to 1.
 IFeatureVector<T> unit()
          Creates a new vector equivalent to this.clamp(1).
 java.util.Set<java.lang.Double> values()
          The set of values which have some element associated with them in this FeatureVector.
By convention, this set is not backed by the FeatureVector so it may be modified without consequence.

Other implementations should try to follow this convention as well.
 

Field Detail

HASH_MAP_POOL

static final HashMapPool HASH_MAP_POOL
Method Detail

get

double get(T term)
Parameters:
term -
Returns:

dot

double dot(IFeatureVector<T> v)
Calculates the dot product of this vector with another vector.

Parameters:
v - Vector to dot this Vector with.

norm

double norm()
Calculates the Euclidean norm/length of this vector. The squares of each element are added together, and the square root of the result is taken and returned.

Returns:
The norm of the vector

max

double max()
Returns the value in the vector with the largest magnitude. ( e.g. -5 is the max of {0,2,4,-5} )

Returns:
the max value in the vector

elements

java.util.Set<T> elements()
The set of elements which have some value associated with them in this FeatureVector.
By convention, this set is not backed by the FeatureVector so it may be modified without consequence.

Other implementations should try to follow this convention as well.

Returns:
the set of elements represented in this FeatureVector.

values

java.util.Set<java.lang.Double> values()
The set of values which have some element associated with them in this FeatureVector.
By convention, this set is not backed by the FeatureVector so it may be modified without consequence.

Other implementations should try to follow this convention as well.

Returns:
the set of values represented in this FeatureVector.

map

java.util.Map<T,java.lang.Double> map()
A reference to the underlying Map backing this vector

Returns:
the Map representing a particular FeatureVector

unit

IFeatureVector<T> unit()
Creates a new vector equivalent to this.clamp(1). Not a real unit vector in the euclidean sense.

Returns:
unit length FeatureVector

simplex

IFeatureVector<T> simplex()
Creates a new vector with the same elements as this vector, setting all the values to 1.

Returns:
simplex FeatureVector

dotSimplex

double dotSimplex(IFeatureVector<T> v)
Returns the dot product of this vector and the simplex of the passed in vector.

You can the average value of all the elements in this vector which are common to both by dividing this result by the commonDimensions.

Parameters:
v - vector to simplex and dot with this vector
Returns:

commonDimensions

int commonDimensions(IFeatureVector<T> v)
Returns the number of common elements in this vector and the passed in vector

Parameters:
v -
Returns: