edu.wlu.cs.levy.RAAM
Class RAAM

java.lang.Object
  |
  +--edu.wlu.cs.levy.RAAM.RAAM

public class RAAM
extends java.lang.Object

Pollack's Recursive Auto-Associative Memory using SNARLI. Based on

@Article{Pollack90,
   author = 	 {Pollack, J.B.},
   title = 	 {Recursive distributed representations},
   journal = 	 {Artifical Intelligence},
   year = 	 {1990},
   volume = 	 {36},
   pages = 	 {77-105}
 }
  
This version of RAAM differs from Pollack's in using a terminal test based on proximity to dictionary entries, rather than an absolute threshold.


Constructor Summary
RAAM(int nhid, int arity)
          Creates a RAAM encoder/decoder network with specified number of hidden units.
RAAM(int nhid, int arity, long seed)
          Creates a RAAM encoder/decoder network with specified number of hidden units.
RAAM(int nhid, int arity, java.util.Random rand)
          Creates a RAAM encoder/decoder network with specified number of hidden units.
 
Method Summary
 edu.wlu.cs.levy.RAAM.Tree decode(double[] code, edu.wlu.cs.levy.RAAM.Vectionary dict)
          Decodes a fixed-size vector to a tree.
 double[] encode(edu.wlu.cs.levy.RAAM.Tree tree, edu.wlu.cs.levy.RAAM.Vectionary dict)
          Encodes a tree to a fixed-size vector.
 double[][] getDecoder()
          Returns decoder weights, biases as IFS (one row per transform)
 void train(edu.wlu.cs.levy.RAAM.Tree[] trees, edu.wlu.cs.levy.RAAM.Vectionary dict, int nep, double eta, double mu, int report)
          Trains the RAAM network on a set of trees.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RAAM

public RAAM(int nhid,
            int arity)
Creates a RAAM encoder/decoder network with specified number of hidden units. Number of inputs = number of outputs = twice this number. Initializes network weights and biases to small random values.

Parameters:
nhid - number of hidden units
arity - fixed tree arity

RAAM

public RAAM(int nhid,
            int arity,
            long seed)
Creates a RAAM encoder/decoder network with specified number of hidden units. Number of inputs = number of outputs = twice this number. Initializes network weights and biases to small random values determined by random-number generator seed.

Parameters:
nhid - number of hidden units
arity - fixed tree arity
seed - seed for random-number generator

RAAM

public RAAM(int nhid,
            int arity,
            java.util.Random rand)
Creates a RAAM encoder/decoder network with specified number of hidden units. Number of inputs = number of outputs = twice this number. Initializes network weights and biases to small random values determined by random-number generator.

Parameters:
nhid - number of hidden units
arity - fixed tree arity
rand - random-number generator
Method Detail

train

public void train(edu.wlu.cs.levy.RAAM.Tree[] trees,
                  edu.wlu.cs.levy.RAAM.Vectionary dict,
                  int nep,
                  double eta,
                  double mu,
                  int report)
           throws java.lang.IllegalArgumentException
Trains the RAAM network on a set of trees.

Parameters:
trees - trees to learn
dict - dictionary mapping from terminals to fixed-size arrays
nep - number of epochs
eta - learning rate
mu - momentum
report - epochs between error reports
Throws:
java.lang.IllegalArgumentException - if trees aren't binary
java.lang.IllegalArgumentException - if size of any dictionary entry mismatches number of hidden units

encode

public double[] encode(edu.wlu.cs.levy.RAAM.Tree tree,
                       edu.wlu.cs.levy.RAAM.Vectionary dict)
                throws java.lang.IllegalArgumentException
Encodes a tree to a fixed-size vector.

Parameters:
tree - tree to encode
dict - dictionary mapping from terminals to fixed-size arrays
Returns:
fixed-size vector encoding tree
Throws:
java.lang.IllegalArgumentException - if tree isn't binary
java.lang.IllegalArgumentException - if size of any dictionary entry mismatches number of hidden units

decode

public edu.wlu.cs.levy.RAAM.Tree decode(double[] code,
                                        edu.wlu.cs.levy.RAAM.Vectionary dict)
                                 throws java.lang.IllegalArgumentException
Decodes a fixed-size vector to a tree.

Parameters:
code - fixed-size vector encoding
dict - dictionary mapping from terminals to fixed-size arrays
Returns:
decoded tree
Throws:
java.lang.IllegalArgumentException - if size of code or dictionary entry mismatches number of hidden units

getDecoder

public double[][] getDecoder()
Returns decoder weights, biases as IFS (one row per transform)

Returns:
IFS weights