

PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 
java.lang.Object gov.sandia.cognition.util.AbstractCloneableSerializable gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm<ResultType> gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner<Collection<Vector>,PrincipalComponentsAnalysisFunction> gov.sandia.cognition.learning.algorithm.pca.GeneralizedHebbianAlgorithm
@CodeReview(reviewer="Kevin R. Dixon", date="20080723", changesNeeded=false, comments={"Added PublicationReference to Sanger\'s master\'s thesis.","Minor changes to javadoc.","Looks fine."}) @PublicationReference(author="Terrence D. Sanger", title="Optimal Unsupervised Learning in a SingleLayer Linear Feedforward Neural Network", type=Thesis, year=1989, url="http://ececlassweb.ucsd.edu/winter06/ece173/documents/Sanger%201989%20%20Optimal%20Unsupervised%20Learning%20in%20a%20Singlelayer%20Linear%20FeedforwardNN.pdf") public class GeneralizedHebbianAlgorithm
Implementation of the Generalized Hebbian Algorithm, also known as Sanger's Rule, which is a generalization of Oja's Rule. This algorithm is an iterative version of Principal Component Analysis. GHA finds the "num" Vectors corresponding to the "num" largest singular values of the covariance matrix of the data. The result is a VectorFunction that maps the input space onto a reduced "num" dimensional space, which captures the directions of maximal variance. The ith row in the resulting matrix approximates the ith column of the "U" matrix of the Singular Value Decomposition. Amazingly, this implementation is faster than the time taken to perform closedform SVD on datasets, and is practical on datasets too large for an SVD.
Field Summary  

static String 
PERFORMANCE_NAME
The performance name is "Change". 
Fields inherited from class gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner 

data, keepGoing 
Fields inherited from class gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm 

maxIterations 
Fields inherited from class gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm 

DEFAULT_ITERATION, iteration 
Constructor Summary  

GeneralizedHebbianAlgorithm(int numComponents,
double learningRate,
int maxIterations,
double minChange)
Creates a new instance of GeneralizedHebbianAlgorithm 
Method Summary  

protected void 
cleanupAlgorithm()
Called to clean up the learning algorithm's state after learning has finished. 
GeneralizedHebbianAlgorithm 
clone()
This makes public the clone method on the Object class and
removes the exception that it throws. 
double 
getChange()
Gets the change in in the last completed step of the algorithm. 
double 
getLearningRate()
Getter for learningRate 
double 
getMinChange()
Getter for minChange 
int 
getNumComponents()
Gets the number of components used in the PCA dimension reduction. 
NamedValue<Double> 
getPerformance()
Gets the namevalue pair that describes the current performance of the algorithm. 
PrincipalComponentsAnalysisFunction 
getResult()
Gets the VectorFunction that maps from the input space to the reduced output space of "getNumComponents" dimensions. 
protected boolean 
initializeAlgorithm()
Called to initialize the learning algorithm's state based on the data that is stored in the data field. 
void 
setLearningRate(double learningRate)
Setter for learningRate 
void 
setMinChange(double minChange)
Setter for minChange 
void 
setNumComponents(int numComponents)
Setter for numComponents 
protected void 
setResult(PrincipalComponentsAnalysisFunction result)
Setter for result 
protected boolean 
step()
Called to take a single step of the learning algorithm. 
Methods inherited from class gov.sandia.cognition.learning.algorithm.AbstractAnytimeBatchLearner 

getData, getKeepGoing, learn, setData, setKeepGoing, stop 
Methods inherited from class gov.sandia.cognition.algorithm.AbstractAnytimeAlgorithm 

getMaxIterations, isResultValid, setMaxIterations 
Methods inherited from class gov.sandia.cognition.algorithm.AbstractIterativeAlgorithm 

addIterativeAlgorithmListener, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners 
Methods inherited from class java.lang.Object 

equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 
Methods inherited from interface gov.sandia.cognition.learning.algorithm.BatchLearner 

learn 
Methods inherited from interface gov.sandia.cognition.algorithm.AnytimeAlgorithm 

getMaxIterations, setMaxIterations 
Methods inherited from interface gov.sandia.cognition.algorithm.IterativeAlgorithm 

addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener 
Methods inherited from interface gov.sandia.cognition.algorithm.StoppableAlgorithm 

isResultValid 
Field Detail 

public static final String PERFORMANCE_NAME
Constructor Detail 

public GeneralizedHebbianAlgorithm(int numComponents, double learningRate, int maxIterations, double minChange)
minChange
 Minimum change below which to stop iterating, greater than or equal to
zero, typically 1e10numComponents
 Number of components to extract from the data, must be greater than zerolearningRate
 Learning rate, or step size, (0,1], typically ~0.1maxIterations
 Maximum number of iterations before stoppingMethod Detail 

public GeneralizedHebbianAlgorithm clone()
AbstractCloneableSerializable
Object
class and
removes the exception that it throws. Its default behavior is to
automatically create a clone of the exact type of object that the
clone is called on and to copy all primitives but to keep all references,
which means it is a shallow copy.
Extensions of this class may want to override this method (but call
super.clone()
to implement a "smart copy". That is, to target
the most common use case for creating a copy of the object. Because of
the default behavior being a shallow copy, extending classes only need
to handle fields that need to have a deeper copy (or those that need to
be reset). Some of the methods in ObjectUtil
may be helpful in
implementing a custom clone method.
Note: The contract of this method is that you must use
super.clone()
as the basis for your implementation.
clone
in interface CloneableSerializable
clone
in class AbstractAnytimeBatchLearner<Collection<Vector>,PrincipalComponentsAnalysisFunction>
protected boolean initializeAlgorithm()
AbstractAnytimeBatchLearner
initializeAlgorithm
in class AbstractAnytimeBatchLearner<Collection<Vector>,PrincipalComponentsAnalysisFunction>
protected void cleanupAlgorithm()
AbstractAnytimeBatchLearner
cleanupAlgorithm
in class AbstractAnytimeBatchLearner<Collection<Vector>,PrincipalComponentsAnalysisFunction>
protected boolean step()
AbstractAnytimeBatchLearner
step
in class AbstractAnytimeBatchLearner<Collection<Vector>,PrincipalComponentsAnalysisFunction>
public double getLearningRate()
public void setLearningRate(double learningRate)
learningRate
 Learning rate, or step size, (0,1], typically ~0.1public double getMinChange()
public void setMinChange(double minChange)
minChange
 Minimum change below which to stop iterating, greater than or equal to
zero, typically 1e10public int getNumComponents()
PrincipalComponentsAnalysis
getNumComponents
in interface PrincipalComponentsAnalysis
public void setNumComponents(int numComponents)
numComponents
 Number of components to extract from the data, must be greater than zeropublic PrincipalComponentsAnalysisFunction getResult()
PrincipalComponentsAnalysis
getResult
in interface AnytimeAlgorithm<PrincipalComponentsAnalysisFunction>
getResult
in interface PrincipalComponentsAnalysis
protected void setResult(PrincipalComponentsAnalysisFunction result)
result
 Vector function that maps the input space onto a numComponentsdimension
Vector representing the directions of maximal variance (information
gain). The ith row in the matrix approximates the ith column of the
"U" matrix of the Singular Value Decomposition.public double getChange()
public NamedValue<Double> getPerformance()
MeasurablePerformanceAlgorithm
getPerformance
in interface MeasurablePerformanceAlgorithm


PREV CLASS NEXT CLASS  FRAMES NO FRAMES  
SUMMARY: NESTED  FIELD  CONSTR  METHOD  DETAIL: FIELD  CONSTR  METHOD 