|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectdlife.sys.SerializationBase
dlife.nn.NeuralNetwork
dlife.nn.CMACNeuralNetwork
public class CMACNeuralNetwork
Implementation of a CMAC (Cerebellar Model Articulation Controller) Neural Network. The CMAC Neural Network had the desirable property that it will generalize between inputs that are similar while not between inputs that are dissimilar. Thus, it is ideal for applications where similar inputs should generate similar outputs while dissimilar inputs should generate significantly different outputs.
Note: None of the following is necessary knowledge for using this class.
This implementation is based upon the somewhat cryptic description in the following papers:
Albus, J. (1975a). A New Approach to Manipulator Control: The Cerebellar Model Articulation Controller (CMAC). Journal of Dynamic Systems, Measurement and Control. Transactions of the ASME, September 1975. pp. 220-227.
Albus, J. (1975b). Data Storage in the Cerebellar Model Articulation Controller (CMAC). Journal of Dynamic Systems, Measurement and Control. Transactions of the ASME, September 1975. pp. 228-233.
The figure below shows a conceptual model of the CMAC neural network. It provides a basis for the following discussion of how the network outputs are computed.

The receptive fields are arranged into layers using the regular pattern shown in the figure. The maximum height of a receptive field (in quantization units, as determined by the number of divisions) is the same as the number of layers (e.g. 4 units in the figure). The receptive fields in each layer are offset from the previous layer by one quantization unit. Receptive fields within each layer are numbered sequentially from top to bottom starting from 1 (black numbers). The receptive fields are also numbered globally by going across the layers and then down the layers starting from 1 (red numbers).
To compute the addresses of the weights used to compute the output, the inputs are first scaled to be in the range [0...1]. Note that inputs are numbered starting with 0. Each input is then mapped to the global receptive field numbers (red numbers) that it intersects. An address is generated for each layer of receptive fields by concatenating the global receptive field numbers of the active fields from that layer. The set of addresses, one for each layer, form the addresses of the weights to be used to compute the network's output. Each weight is found by looking them up in a hash map using the address as the key. If no weight is found, it is assumed to be 0 and is added to the hash map.
Note: The current implementation expects that all inputs have the same range of possible values and the same level of quantization.
Note: One significant difference between this implementation and Albus' description is that the hashing function from association cells to weights used here is collision free. This implementation uses a HashMap to map from association cells to weights. This has the advantage of being collision free, but can require a significant amount of space depending upon the CMAC parameters and the portion of the association cells that are encountered in any given run.
| Field Summary |
|---|
| Fields inherited from class dlife.nn.NeuralNetwork |
|---|
filteredInputs, filteredOutputs, rawInputs, rawOutputs |
| Constructor Summary | |
|---|---|
CMACNeuralNetwork(int inputs,
int rfLayers,
double minValue,
double maxValue,
int divisions,
double beta)
Construct a new CMACNeuralNetwork assuming that all of the inputs have the same range, and will be divided into the same number of divisions. |
|
| Method Summary | |
|---|---|
static void |
main(String[] args)
A test method that trains the CMAC for the cos function on the range [0...10] and reports the result of evaluating the network performance. |
void |
propagate()
Propagate the current input values through this CMAC. |
void |
train(double target)
Perform one weight adjustment that will bring the output for the current inputs closer to the specified target. |
| Methods inherited from class dlife.nn.NeuralNetwork |
|---|
evaluate, evaluate, getFilteredInputs, getFilteredOutputs, getInputFilter, getInputFilter, getOutputFilter, getOutputFilter, getRawInputs, getRawOutputs, setInputFilter, setInputFilter, setInputs, setOutputFilter, setOutputFilter, setOutputs |
| Methods inherited from class dlife.sys.SerializationBase |
|---|
read, write |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CMACNeuralNetwork(int inputs,
int rfLayers,
double minValue,
double maxValue,
int divisions,
double beta)
inputs - the number of inputs to the CMAC.rfLayers - the number of receptive fields that will be activated by
each input. This value also determines the width (in
divisions) of each receptive field.minValue - the minimum value that all inputs can take on.maxValue - the maximum value that all inputs can take on.divisions - the number of units into which to divide all of the
input ranges.beta - the learning rate for this CMAC.| Method Detail |
|---|
public void propagate()
throws IllegalStateException
propagate in class NeuralNetworkIllegalStateException - if the inputs have not been set.
public void train(double target)
throws IllegalStateException
target - the desired (filtered) output for the current input.
IllegalStateException - if the inputs have not been set.public static void main(String[] args)
args - none.
|
dLife Home Page | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||