Erlang: The Unintentional Neural Network Programming Language
Erlang is well-suited as a programming language for neural networks due to its inherent features that match the necessary features for neural network programming languages, such as encapsulation, concurrency, fault detection, and dynamic code upgrade. The document describes using Erlang to implement artificial neural networks and evolutionary algorithms for training neural networks. It presents DXNN, a case study of a modular, distributed neural network architecture implemented in Erlang that uses a genetic algorithm with local search to train network topologies on tasks like double pole balancing.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
155 views56 pages
Erlang: The Unintentional Neural Network Programming Language
Erlang is well-suited as a programming language for neural networks due to its inherent features that match the necessary features for neural network programming languages, such as encapsulation, concurrency, fault detection, and dynamic code upgrade. The document describes using Erlang to implement artificial neural networks and evolutionary algorithms for training neural networks. It presents DXNN, a case study of a modular, distributed neural network architecture implemented in Erlang that uses a genetic algorithm with local search to train network topologies on tasks like double pole balancing.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 56
Erlang: The Unintentional Neural
Network Programming Language
Erlang Factory San Francisco March 20ll Gene Sher
lntroduction ! The Long Standing Goals of Computational lntelligence ! Brain is just an organic substrate based NN ! Blue Brain Project - http://bluebrain.epfl.ch/ ! Computer hardware is advancing steadily ! A programming language is needed with the right features ! Erlang: As the NN Programming Language
Computational lntelligence Through Genetic Algorithms and Neural Networks
Biological Neural Network
Artificial Neural Networks ! Simulate biological NNs to various degrees of precision ! Directed graphs ! Parallel ! Learn, adapt, and generalize n-1 n-2 n-3 n-4 n-3 Sense/lnput Act/Output
The lnput is Just a Vector AF:tanh Weights: [0.3,0.2| [-l,l] Output lnput l. Dot product: DP=(0.5-l) + (0.2l) Threshold = (0l) 2. Activation strength: Output = tanh(DP+Threshold) [-0.29]
A Neural Network [0.3,1| [1| [1,0,-1| [0.5] [2,-2] tanh(0.52 + l-2) tanh(l0.5) l Bias tanh(l-0.76 + 00.46 + -ll) [-0.76] [0.46] [-0.94] Wind Speed Now Wind Speed Later Coordinates tanh(tanh(C dot W) + tanh(WSP dot W))
NN Learning & Plasticity Algorithms ! Supervised ! Backpropagation ! ... ! Unsupervised ! Kohonan (Self-organizing) map ! Adaptive Resonance Theory ! Hebbian " "The general idea is an old one, that any two cells or systems of cells that are repeatedly active at the same time will tend to become 'associated', so that activity in one facilitates activity in the other." (Hebb l949, p. 70) ! Modulated ! Evolutionary ! ..
Evolutionary Computation ! Based on evolutionary principles ! Stochastic search with a purpose ! Survival of the fittest ! Genotype to Phenotype ! Mutation and crossover
George E. P. Box ! lmproving productivity in a chemical process plant at lmperial Chemical lndustries Ltd. l.Vary a setting 2.See what happens 3.??? 4.Profit!!!
Evolutionary Computation Flowchart lnitialize the population Create offspring through random variation Evaluate fitness of each candidate solution Apply selection algorithm Terminate? Yes No
Simple Genetic Algorithm Example
Genotypes A l00l B 0000 C l0l0 D 0l0l Phenotypes Genotypes lll0 0l00 l0l0 0l0l Phenotypes Genotypes lll0 llll l0l0 00l0 Simple Mutations Genotypes A l00l B 0000 C l0l0 D 0l0l Phenotypes Genotypes l0ll ll0l l0l0 0l0l Phenotypes Genotypes l0ll ll0l l00l llll Crossover Gen-l Gen-2 Gen-3 Gen-l Gen-2 Gen-3 Phenotypes Phenotypes
Simple Hill Climber AF:tanh Weights: [W| l. [l] 2. [-l] Output lnput tanh(lW) lnitial W = l l want: Output == 0 l. Outputl = tanh(ll) = 0.76 Output2 = tanh(l-l) = -0.76 2. Perturbation power!!! Perturbation = -0.5 Try W = 0.5 = l - 0.5 Outputl = tanh(0.5l) = 0.46 Output2 = tanh(0.5-l) = -0.46 That's closer! New W = 0.5 3. Perturbation power!!! Perturbation = +0.2 Try W = 0.7 = 0.5 + 0.2 Outputl = tanh(0.7l) = 0.60 Output2 = tanh(0.7-l) = -0.60 Not as good as before, New W = 0.5 4. Perturbation power!!! Perturbation = -0.5 Try W = 0 = 0.5 - 0.5 Outputl = tanh(0l) = 0 !!! Output2 = tanh(0-l) = 0 !!! The right weight is 0.
Evolutionary Computation Approaches ! Genetic Algorithms (John Holland, 73-75) ! Population of fixed length genotypes, bit strings, evolved through perturbation/crossing ! Genetic Programming (John Koza, 92) ! Variable sized chromosome based programs represented as treelike structures, with specially crafted genetic operators ! Evolutionary Strategies (lngo Rechenberg, 73) ! Normal distribution based, adaptive perturbations (self-adaptation) ! Evolutionary Programming (L. & D. Fogel, 63) ! Like ES, but for evolution of state transition tables for finite-state machines (FSMs)
TWEANN Cycle Seed NN population Apply to problem Calculate fitness scores Select fit organisms Create offspring
NN Programming Language
Necessary Features for a NN-PL (These will sound very familiar) ! Encapsulation ! Concurrency through Neuron primitives ! Fault detection primitives ! Location transparency ! Dynamic code upgrade
Monolithic NN Supervision Tree NN_Sup Supervisor Sensor Actuator Neuron Neuron Neuron Population Monitor Supervisors Workers Monitor Root Supervisor NN
Genotype Storing and Encoding ! Tuple encoded ! {neuron,lnputPlds,OutputPlds,Ws,AF,PF} ! Relational database friendly ! Human readable ! Standard directed graph vertex and edge based ! Mutation operators are standard digraph opreators ! Add/remove Neuron/Vertex ! Add/remove Synapse/Edge
Mnesia as Storage for Genotypes ! Robust and safe ! Tuple friendly ! Easy atomic mutations ! lf any part of the mutation fails, the whole mutation is just retracted automatically
Modular NN Topology Mapping PId PId PId PId PId PId PId Pld Pld N1 N2 N3 N4 N3 I1 I2 Ol O2 PId Ml M3 M4 M1 M2 Al A2 S1 S2
Modular NN Supervision Tree NN_Sup Neuron Neuron Neuron Population Monitor Supervisors Workers Modular NN Module Neuron Neuron Neuron Module Supervisors Root Supervisor Sensor Actuator Workers
What Erlang Offers to the Field of NN Research ! Augmenting topologies live ! Full distribution and utilization of hardware ! Fault tolerance; "stroke recovery" ! l:l mapping, from ideas to prototype systems ! No need to overcome linguistic determinism ! Switching and adding new modules, no matter what they do, requires no rewrite thanks to message passing ! Flexibility... in everything!
DXNN: A Case Study
Memetic Algorithm Based TWEANN Seed NN population Apply to problem Calculate fitness scores Select fit organisms Create offspring Local Search: Hill Climber
Evolving Topologies N(1,1) N(2,1) S1 Al N(1,1) N(2,1) N(3,1) S2 Al N(1,1) N(1,2) N(2,1) N(3,1) S1 S2 Al N(1,1) N(1,2) N(2,1) N(3,1) N(3,1) S1 S2 Al A2
Seed Population ! Total first layer neurons = total # of sensors ! Total last layer neurons = output vector length ! This is usually the sum of actuator vector lengths ! Choose AF, PF... randomly from the available lists
Complexification and Elaboration ! Start with a simple initial topology ! Add to and elaborate on the topology during mutation phases ! Apply parametric mutations only to the newly created Neurons ! Scale the fitness scores based on NN size
Double Pole Benchmark Double pole balancing with velocities Without velocities, without damping Without velocities, with damping Method Evaluations Method Evaluations Method Evaluations RWG 474329 RWG 4l5209 RWG l232296 EP 307200 EP EP CNE 22l00 CNE 76906 CNE 87623 SANE l2600 SANE 262700 SANE 45l6l2 Q-MLP l0582 Q-MLP Q-MLP NEAT 3600 NEAT NEAT 6929 ESP 3800 ESP 7374 ESP 26342 954 l249 34l6 CMA-EX 895 CMA-EX 352l CMA-EX 606l DXNN 725 DXNN 2359 DXNN 23l3 CoSyNE CoSyNE CoSyNE Non DXNN data taken from Table-3, Table-4 of: Faustino Gomez, Jurgen Schmidhuber, Risto Miikkulainen,: Accelerated Neural Evolution through Cooperatively Coevolved Synapses. Journal of Machine Learning Research 9 (2008) 937-965
Artificial Life Setup DXNN DXNN DXNN DXNN Collision Detection Population Monitor
2d Robots and Sensor Types 0- 90 90- l80 l80- 270 270- 360 Predator P r e y Sensor angle coverage, resolution=4 Plant Poison Ray casting based sensors
Predator vs. Prey
Evolving Hardware PId PId PId PId PId not and or and not PId PId Sl S2 Pld Pld Ol O2 AFs: [tanh,sin,abs...] AFs: [AND,NOT,OR]
Modules as general programs Where each Module can be externally evolved NN, a general program, a circuit, a substrate encoded NN... PId PId PId PId Al A2 Sl S2 M3 M4 M1 M2 Al A2 Sl S2
QuadCopter Stabilization Cortex M3 M4 M1 M2 Sensors Actuators OS Sensor Data Prop Speeds: [P1,P2,P3,P4| Player/Gazebo
Bipedal Gait Cortex M3 M4 M1 M2 Sensors Actuators OS Sensor Data R Joint Angles: [R1,R2,R3| Player/Gazebo L Joint Angles: [L1,L2,L3|
Time Series Analysis (Through a sliding window) Cortex M3 M4 M1 M2 Sensors Actuators OS l 2 l 4 3 4 2 3 2 2 3... 3.9 Prediction Cur. Window
Coevolution ! Environment and fitness landscape is created by the interaction of competing species ! Arms race
UAVs & Aerial Combat Bently Creative Evolutiony Systems, Ch-l9, Discovering Novel Fighter Combat Maneuvers: Simulating Test Pilot Creativity Cortex Sensors Actuators Sensor Data Pspeeds, Atk: [P1,P2,P3,P4,A| Player/Gazebo Cortex Sensors Actuators Pspeeds, Atk: [P1,P2,P3,P4,A| Sensor Data
Cyberwarfare (Something like metasploit, but NN provides the parameters and chooses the tools) DETER (NetSecTestbed) can be found at http://www.isi.deterlab.net/ Cortex Sensors Actuators Network Data Parameters: [T1,P1,T2,P2...| ns3 or DETER Cortex Sensors Actuators Parameters: [T1,P1,T2,P2...| Network Data Attacker Defender
Conclusion & Future Work ! Memetic vs Genetic ! Spiking neural networks and fault tolerance ! Over-the-net distribution and sensing ! Artificial life, 3d systems, distributed processing... ! Towards more realistic simulators and evolving greater complexity...
Thanks! Questions? ! Learn More ! Preprints available on arxiv.org ! Get the code ! Will be available on github soon ! Get in touch ! [email protected]