The following introduces some fundamentals of neural networks, stuff that has been around forever and has nothing to do with TensorFlow.
This is also not specifically about “deep learning” style inference. That is the world of regularized multi-layer perceptrons called convolutional neural networks, with each neuron connecting to all of those in the following layer. Useful for image classification, but suffer from over-fitting.
Rather, the desired functions are:
- Correct user input and documents so that names and terminology are consistent, and provide learning loop to reinforce positive behaviors
- Infer whether objects in an abstract graph are related, and if so build relations between them and propagate changes up to aggregates
- Make recommendations on data sources for specific uses, and identify opportunities to improve synthetic data sets
- Predict time evolution of systems, and fill time and space gaps in sparse data
- Parse natural language into structured queries
Most machine learning activity in marine science that I know of focuses on prediction (#4), or some type of image classification, which is not a focus here. Relationship inference and recommendations (#2 and #3) are birds of a feather, and are not uncommon applications. Natural language stuff (#5) is of course very popular. User feedback learning (#1) is extremely powerful, if you give it enough control over the presentation and operation of the application.
A neural network is made up of layers of neurons and synapses. People use “layers” to mean both neurons and synapses layers, which is wicked confusing. Neuron layers are floating point or integer vectors, and the synapses are 2D arrays with indices that map neighboring neurons to each other. Let’s call them neuronal
layers and synaptic
Layers are instantiated with a default value of zero. The data structure used must support basic array arithmetic, as well as common functions like
normalize(). Matrices must also support matrix arithmetic, instantiation from tensor operation (), and the ability to slice and insert vectors.
The high-level interface is the network structure itself, which handles training neurons, and ushers new inputs through the system. Networks infer relationships between vectors, and may use a vector-pair abstraction in
recall transfer functions. Assignment and equivalence operators are required for this. Networks are defined by the size of input and output patterns, which are arguments to
recall, and have properties of learning rate, signal decay, and error tolerance.
The required methods for a basic implementation are:
train()— run vector-pairs until tolerance is reached
cycle()— pass vector-pairs and invoke
test()— testing is good
run()— run the model
load()— cache the synapse weights
encode()— store a vector pair in the network
recall()— complete the vector-pair input
Neuron internal mechanisms include an adder function which combines the weighted strength of the signals, and threshold function that then computes the activation state. Neurons emit a signal related to the activation state, which may connect to any number of other neurons.
Activation functions are nonlinear. Using a linear function in multi-layer (deep) networks would have no advantage over a single-layer one. The most common are basic step functions and sigmoid squashing functions:
Synapses store information as weights, trained by presenting patterns in sequence. The learning law updates the weights based on the learning rate, . Some simple forms include Hebbian correlation learning (Hebb 1949), with the weight updated by connected activation values, or their sigmoid transform:
The learning rate is “cooled” when it is initialized as a high value, and decreases to zero over successive cycles. This is not used often in practice.
When there is no feedback regarding the quality of the prediction, the process is considered unsupervised, and therefore self-organizing. Modes of unsupervised learning include additive matrix learning (e.g. bidirectional associative memory) and learning vector quantizer (counter-propagation)
Supervised learning is more common. Weights are adjusted based on the error between truth and predicted values follow an error correction law such as , where is the desired activation.
Reinforcement learning is a form of supervision. Each output neuron gets an error value. Here means total error and means threshold. The error is disbursed back to neurons, which have eligibility function, , where means probability of correctness. This adjustment is based on activation state, and does not depend on changes during previous step.
Additional hidden layers makes patterns of higher dimensions separable in parameter space. Training is more complicated, and involves back-propagation of error through hidden layers, a is the weighted sum of errors in the output layers times the activation of the hidden neuron.
Back-propagation (Rumehart and Hinton 1986) is the predominant method of supervised learning. It requires a lot of training data, and domain knowledge of the ideal number of layers and terminal neurons.
The size of hidden layers should be between the number of input and output layers. The model tends to group features from the domain, such as pixels forming line features in optical character recognition. Inputs must be normalized and clamped to (0, 1), and the weights can be adjust either incrementally or once per epoch.
Weights of synapses and neuron thresholds are randomly initialized in (-1, 1). Encoding vector-pairs is accomplished in two stages. The forward pass computes the hidden layer activation, , and then the output activation, . means synaptic matrix. The backward pass computes the output error from a known target . This is used to update :
Then the hidden layer error, , updates :
Cycle until is within tolerance.
The network recalls by computing hidden () and output () activation as before. Thresholds may be used to bias activation,
Counter-propagation networks (CPN) train faster than back-prop, and are better generalizers of new data which may lie outside distributions previous encountered (Hecht-Nielson 1987). The method combines a linear vector quantizer (LVQ, a form of self-organizing map) and a minimal outstar encoder. These can function as lookup tables. These are generally unsupervised, but may be amended with feedback.
There are three layers, and the hidden layer usually only has a single neuron activate at time (some cases there may be more). This is chosen by similarity to encountered patterns, and is a categorization process. There must be a neuron in the hidden layer for each output neuron (category), which is referred to as a capacity problem.
The initial weights are random. Inputs are chosen from the sum of squared differences. Weights of connecting synapses are updated from the difference between input and current state. The outgoing synapses are then updated from the single activated neuron.
New queries activate a single hidden neuron, which produces an output pattern indicating the category.
Bidirectional associative memory systems
The capacity problem of CPN is solved with bidirectional associative memory systems (BAMS). The original formulation (Kosko 1988) was improved upon by Patrick Simpson (1989), by adding new matrices of synaptic weights when the current ones saturate.
This model is based on two-layer feedback nets used for memory addressing, and has useful properties of being stable (training will always converge) and having instant recall. The problem is that the memory usage increases O(n2) with pattern length.
BAMS are useful when mapping between features:
- optical character recognition: pixel pattern —> character
- voice: signal —> word
- spell check: words —> phonemestring
- radar: signal —> object
The matrix is the sum of correlation matrices of pattern pairs,
New pattern pairs are added to the current encoding by computing incremental additions. Pairs can be removed by performing the inverse operation. The matrix is tested to see that each pair can be recalled. If not, the last entry is removed and stored in a new matrix.
When one part of a pair is presented, the network will recall the complement, or a close match. Patterns are passed back and forth through the matrix and transpose until it converges on a solution, which is guaranteed to exist according to Lyapunov energy function,
Don’t know the location of the information, since it is spread around, so the program queries each matrix for pairs with the same energy as desired. This is more computationally expensive than checking a single source.
By modifying the M encoding methods, can favor convergence or accuracy. Options include the Hebb’s signal function from before, competitive encoding, or differential Hebb’s.
Single layer auto associative pattern storage (Hopfield 1985) useful for applications like the traveling salesman problem.
Encoding For discrete cases, add product of activation to weight,
Continuous nets are more flexible, act like circuit, with neuron conductance,
The function is arbitrary.