gov.sandia.cognition.text.topic
Class LatentSemanticAnalysis.Transform

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.text.topic.LatentSemanticAnalysis.Transform
All Implemented Interfaces:
Evaluator<Vectorizable,Vector>, VectorInputEvaluator<Vectorizable,Vector>, VectorOutputEvaluator<Vectorizable,Vector>, CloneableSerializable, Serializable, Cloneable
Enclosing class:
LatentSemanticAnalysis

public static class LatentSemanticAnalysis.Transform
extends AbstractCloneableSerializable
implements Evaluator<Vectorizable,Vector>, VectorInputEvaluator<Vectorizable,Vector>, VectorOutputEvaluator<Vectorizable,Vector>

The result from doing latent semantic analysis (LSA). It is a transform that can be applied as a dimensionality reduction.

See Also:
Serialized Form

Field Summary
protected  Matrix singularValues
          The diagonal matrix of singular values.
protected  Matrix termBasis
          The matrix of orthogonal term column vectors.
protected  Matrix transform
          The cached transform matrix.
 
Constructor Summary
LatentSemanticAnalysis.Transform(Matrix termBasis, Matrix singularValues)
          Create a new Transform
 
Method Summary
 Vector evaluate(Vectorizable input)
          Evaluates the function on the given input and returns the output.
 int getInputDimensionality()
          Gets the expected dimensionality of the input vector to the evaluator, if it is known.
 int getOutputDimensionality()
          Gets the expected dimensionality of the output vector of the evaluator, if it is known.
 int getRank()
          Gets the rank of the LSA.
 Matrix getSingularValues()
          Gets the diagonal matrix of singular values.
 Matrix getTermBasis()
          Gets the matrix of orthogonal term column vectors.
 Vector getTermVector(int i)
          Gets the i-th orthogonal term vector that makes up the basis for the transform.
 Matrix getTransform()
          Gets the cached transform matrix.
protected  void setSingularValues(Matrix singularValues)
          Sets the diagonal matrix of singular values.
protected  void setTermBasis(Matrix termBasis)
          Sets the matrix of orthogonal term column vectors.
protected  void setTransform(Matrix transform)
          Gets the cached transform matrix.
 
Methods inherited from class gov.sandia.cognition.util.AbstractCloneableSerializable
clone
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

termBasis

protected Matrix termBasis
The matrix of orthogonal term column vectors.


singularValues

protected Matrix singularValues
The diagonal matrix of singular values.


transform

protected Matrix transform
The cached transform matrix. It is the term basis times the singular values.

Constructor Detail

LatentSemanticAnalysis.Transform

public LatentSemanticAnalysis.Transform(Matrix termBasis,
                                        Matrix singularValues)
Create a new Transform

Parameters:
termBasis - The matrix of orthogonal term column vectors.
singularValues - The diagonal matrix of singular values.
Method Detail

evaluate

public Vector evaluate(Vectorizable input)
Description copied from interface: Evaluator
Evaluates the function on the given input and returns the output.

Specified by:
evaluate in interface Evaluator<Vectorizable,Vector>
Parameters:
input - The input to evaluate.
Returns:
The output produced by evaluating the input.

getInputDimensionality

public int getInputDimensionality()
Description copied from interface: VectorInputEvaluator
Gets the expected dimensionality of the input vector to the evaluator, if it is known. If it is not known, -1 is returned.

Specified by:
getInputDimensionality in interface VectorInputEvaluator<Vectorizable,Vector>
Returns:
The expected dimensionality of the input vector to the evaluator, or -1 if it is not known.

getOutputDimensionality

public int getOutputDimensionality()
Description copied from interface: VectorOutputEvaluator
Gets the expected dimensionality of the output vector of the evaluator, if it is known. If it is not known, -1 is returned.

Specified by:
getOutputDimensionality in interface VectorOutputEvaluator<Vectorizable,Vector>
Returns:
The expected dimensionality of the output vector of the evaluator, or -1 if it is not known.

getRank

public int getRank()
Gets the rank of the LSA. This is equivalent to the output dimensionality of the transform.

Returns:
The rank of the LSA.

getTermVector

public Vector getTermVector(int i)
Gets the i-th orthogonal term vector that makes up the basis for the transform.

Parameters:
i - An index. Must be between 0 (inclusive) and rank (exclusive).
Returns:
The i-th orthogonal term vector.

getTermBasis

public Matrix getTermBasis()
Gets the matrix of orthogonal term column vectors.

Returns:
The matrix of orthogonal term column vectors.

setTermBasis

protected void setTermBasis(Matrix termBasis)
Sets the matrix of orthogonal term column vectors.

Parameters:
termBasis - The matrix of orthogonal term column vectors.

getSingularValues

public Matrix getSingularValues()
Gets the diagonal matrix of singular values.

Returns:
The diagonal matrix of singular values.

setSingularValues

protected void setSingularValues(Matrix singularValues)
Sets the diagonal matrix of singular values.

Parameters:
singularValues - The diagonal matrix of singular values.

getTransform

public Matrix getTransform()
Gets the cached transform matrix. It is the term basis times the singular values.

Returns:
The cached transform matrix.

setTransform

protected void setTransform(Matrix transform)
Gets the cached transform matrix. It is the term basis times the singular values.

Parameters:
transform - The cached transform matrix.