Tuesday, 29 October 2013

Voxel Project

Introduction to Voxels

Traditional robots are typically composed of hard fixed components linked together by hinges, joints and powered by motors and gears. These have success in may areas but lack the adaptability and precision that we see in the natural world, the simplest example is to list the robots capable of lifting an egg and placing in a saucepan. In recent years work has progressed on a new range of 'soft body' robots that use new composite materials and manufacturing methods to create more biologically inspired robots. The most notable of these is the robot tentacle [1], which has shown workable examples of potential use for; bomb disposal, surgery tools and cleanup tasks in hazardous environments. As impressive as this design is it is still crafted by the human hand and can only ever be as good as it's human inventor.

A parallel line of research is into evolving soft body robots within virtual worlds. These are able to utilise a number of simulated materials and produce designs optimally evolved for a given fitness function within their environment. Karl Sims is probably the father of this field producing evolved creatures back in 1994 [2], hardware and software have moved on since then and new techniques commonly use the VoxCAD voxel simulator as a testbed. A voxel is a 3D simulated cube that can be given particular material properties (stiffness, stretch, periodic inflation) these voxels are stacked together and due the the periodic inflating nature of some of these voxels the whole structure can move.


Hackademia Project

Voxels within a simulated environment can be evolved to perform a range of motion tasks and can be optimised via a fitness function to generate designs optimised for speed, energy use or specific environmental factors. However can an evolved solution within the simulated environment perform equally well when that design is copied over to the real world?

To test this hypothesis we are first going to need some voxels. Within the simulator there are typically four materials used; hard, soft and passive, periodic volume increase of 20% in 500 time steps, and out of phase 20% periodic volume increase of 20%.

Hard and soft are relatively easy to manufacture, however a periodic volume increase is much more of an issue. The biggest problem is to create a cube that will increase in volume and yet still retain the cuboid shape and not simply turning into a balloon. The second issue is how to get all faces of the cube to expand equally and also allow for a certain amount of deformation in the cube required to allow motion to happen. The final issue is the same, but how to get a consistant inflation / deflation in all of the phase and out of phase cubes simultaneously.

Below are some of the prototypes that I have been working on:

1.0 : Voxels to cuboids

After much experimenting with different ideas the only way to retain the cube shape was to inflate the design along the cubes edges. The first of may simplifications was to assume that the overall structure would only be one voxel deep, so in effect a 2D collection of voxels. This allowed me to only have to worry about inflating the front face, but to retain stability I would also inflate the rear face leaving the internal edges fixed so rather than a cube we more technically have a cuboid design.

The first step is to be able to push out the required edges, after a little trip to B&Q and raiding the lego pneumatics tray.


Syringes were cut down to reduce the size of the cuboid, this in turn reduces the amount the cuboid would need to be inflated. Next step is to link the edges together, this time a trip to JD Sport.

With squash balls (blue spot for maximum hang time), elastic bands and dowels to complete the design we can build a full cuboid.



[ After discussions with Chris Jack on how to control a collection of 25 (min required for a locomotion design) of these cuboids and a good discussion with Chrisantha on the project direction the decision was made to concentrate on controlling a single cube. This allows me to fully understand the dynamics of the problem and how to effectively scale up and link the cubes in future. This also allows us to explore the rather interesting property of controlling each edge of the cube independently and seeing what dynamics we can get and control with 12 degrees of freedom. ]

2.0  Codename: Squeaky
The first task was to move from cuboid to full cube.  For this I created a quick mockup allowing expansion in all three dimensions that would allow me to check for issues and work on the control system for independently controlling each of the 12 faces. [ Mental note; dowel, syringes and zip ties makes an awful squeaky racket!]

Awaiting a few connectors so that I can complete this project but a few issues have arose, with the extra  flexibility introduced with the extra dimension the design has a habit of rotating on the horizontal plane and collapsing upon itself. This may be simply due to unequal pressure from the elastic bands or too much flexibility in the squash balls. The design will work for testing a control systems as long as the cube does not go over it's collapse threshold point, but a better connection method is top of the todo list.


To Do:
1) New connection method (codename: ******** - well that would give it away!)
2) Control system prototype (control 12 faces independently)



[1] http://www.seas.harvard.edu/suo/papers/279.pdf
[2] http://creativemachines.cornell.edu/sites/default/files/ALIFE10_Hiller.pdf
[3] http://creativemachines.cornell.edu/sites/default/files/GECCO09_Hiller.pdf

Monday, 26 August 2013

Just published: From Blickets to Synapses. How brians do causal inference.

http://onlinelibrary.wiley.com/doi/10.1111/cogs.12073/abstract?deniedAccessCustomisedMessage=&userIsAuthenticated=false

From Blickets to Synapses: Inferring Temporal Causal Networks by Observation


Keywords:

  • Causal inference;
  • Rational process model;
  • Neuronal replicator hypothesis;
  • Polychronous groups;
  • Backwards blocking;
  • Screening-off

Abstract

How do human infants learn the causal dependencies between events? Evidence suggests that this remarkable feat can be achieved by observation of only a handful of examples. Many computational models have been produced to explain how infants perform causal inference without explicit teaching about statistics or the scientific method. Here, we propose a spiking neuronal network implementation that can be entrained to form a dynamical model of the temporal and causal relationships between events that it observes. The network uses spike-time dependent plasticity, long-term depression, and heterosynaptic competition rules to implement Rescorla–Wagner-like learning. Transmission delays between neurons allow the network to learn a forward model of the temporal relationships between events. Within this framework, biologically realistic synaptic plasticity rules account for well-known behavioral data regarding cognitive causal assumptions such as backwards blocking and screening-off. These models can then be run as emulators for state inference. Furthermore, this mechanism is capable of copying synaptic connectivity patterns between neuronal networks by observing the spontaneous spike activity from the neuronal circuit that is to be copied, and it thereby provides a powerful method for transmission of circuit functionality between brain regions.
Read it, or don't. 
Chrisantha

Thursday, 22 August 2013

Projects to continue in September

Dear Hackademics, 

The new current list of people is above. We're going to be very much focused on Darwinian neurodynamics and building unconventional robots using 3D printing and soft sensors to test those algorithms. Boris is working on efficient representations of policies. Chris Jack plans to modify our sensorimotor contingencies somehow, but he'll know better after he gets back from Zurich I hope. Mark is making an unconventional worm bot. 

NOTE OF CAUTION: You should begin your projects by September. The week itself is a final get-together to write up papers together in a peaceful and contemplative environment, and demonstrate hardware, along with sci fi poetry writing and sci-fi cooking of-course. 

Travel arrangements will be as follows; We leave from London on 11th in 2-3 large people carriers which we hire. Mark Roper/Chris Jack and I will drive these. We take equipment 3D printer etc… electronics equipment and so forth.. as needed, we get food delivered from Waitrose or take some as well, we arrive in the evening and make dinner. 

Cheers, 
Chrisantha

Friday, 2 August 2013

Android experiments in child development

Android SDK: http://developer.android.com/sdk/index.html

Instructions for Processing in Android: http://wiki.processing.org/w/Android

Aim: Make a set of simple apps that can be used by Frida to test things like causal inference, associative learning, etc... in a flexible manner. Then extend this to Bamara's attempts to make a doll based on firm principles from child development.

Possible Experiments: 

1. Implement a pictorial version of a 3-node temporal causal network. Reward child with a noise if they can predict the next states of the network, given the current states. This is a game in which one must predict the next states of the system.


Sunday, 14 July 2013

Darwinian Neurodynamics (3): Accumulation of Adaptations & NEAT.

Accumulation of Adaptations

I think this represents the results we should work towards for the Living Machines 2013 exhibit. 

The closest literature that tries to accumulate adaptations in the way we do is the options framework I think (and MAXQ), but they have not demonstrated transfer learning. A review of transfer learning appears here by Taylor and Stone (2009). I summarise some aspects of that article here.

Q1. What knowledge to transfer?

a. Low-level knowledge: i. <s, a,r, s'> instances, action-value function (Q), policy (pi), full task model (model), prior distributions (pri).
b. High-level knowledge: i. What subset of actions A to use in which situations. ii. partial policies or options (basically what we're doing with the archive I think), iii. rules or advice, iv. important features for learning (e.g. perceptual atoms), v. proto-value functions?, vi. shaping rewards (subgoal functions suitable for full goals, subtask definitions).

Examples of Hierarchical Transfer Learning (Including only tasks that can be done in a Jolly Jumper)

Primitive Tasks

1. Agent learns to bounce on a cushion using its knees and ankles.
2. Agent learns to swing forwards and backwards on a cushion using its knees and ankles.
3. Agent learns to rotate around the vertical axis using its knees and ankles.


Permitting variability operators a. and b. will allow new molecule types to come into existence that may be more suitable for recombination. If these operators are evolved along with a recombination operator, then molecule types that suit those operators will evolve.


Purely Sequentially Composite Tasks

1. Bounce (1) for 5 seconds then Swing (2) for 5 seconds.
2. Bounce (1) for 5 seconds then Rotate (3) for 5 seconds.
3. Swing (2) for 5 seconds then Bounce (1) for 5 seconds.
4. Swing (2) for 5 seconds then Rotate (3) for 5 seconds.
5. Rotate (3) for 5 seconds then Bounce (1) for 5 seconds.
6. Rotate (3) for 5 seconds then Swing (2) for 5 seconds.

Purely Parallel Composite Tasks

1. Bounce + Swing
2. Bounce + Rotate
3. Swing + Rotate

at the same time. Fitness is the sum of both primitive fitnesses.

Methods of Transfer

1. FIXED CHAIN the timing of sub-actions. A -(delay = 3)--> B. with fixed delays.
2. CONDITIONAL CHAIN the timing of sub-actions based on termination conditions A --(terminate)-->B.
3. MERGE two compartments with equal priority, such that all motor atoms controlling the same motors now average their motor commands in the motor buffer.

Transfer method 1 would be expected to be able to satisfy the purely sequential composite tasks, if it was possible to execute compartment (x) followed by compartment (y). Currently, our archive retrieval system does not permit combining distinct whole compartments in this way. Neither does it permit the termination condition based method of sequencing whole compartments relative to each other. This is a failing of the current EROS algorithm.

Parallel task recombination would be expected to be helped by (3) the equal priority Merge operator.


Primitive Compartment Mechanisms and Variability Operators.  

1. A large DMP molecule moves knees and ankles taking sensory input from joints and accelerometers.
2. Two small reflex molecules operate ankle and knee movements as a function of FSRs on that leg.

TO DO: Currently, by limiting the molecules to the two above types, we severely restrict the kinds of knowledge transfer that can occur by recombination.

a. Structural changes should be permitted, e.g. removal and formation of edges. Removal is first order, and addition is zeroth order. This will result in the formation of new molecule structures.

b. Mutation of sensor identities should be permitted. Motor identities should also be mutable, within the subset of permitted motors i.e. knees and ankles only.

c. Priorities should also be allowed to mutate.

d. Recombination between compartments in the population (and between compartments in the archive and population should allow molecules to be added (with/without replacement).

e. These operators should be tested with the primitive tasks above.



Notes: 

NEAT Stanley and Miikkulainen (2002) Evolutionary Computation 10(2):99-127 


Neuroevolution of Augmented Topologies attempts to answer these questions. These have been the same questions we've been asking so we should look to see if they have solved all our problems for us. Lets hope they have, otherwise we might need to do some more work. Their questions were...

(1) Is there a genetic representation that allows disparate topologies to cross over in a meaningful way? 

(2) How can topological innovation that needs a few generations to be optimized be protected so that it does not disappear from the population prematurely? 

(3) How can topologies be minimized throughout evolution without the need for a specially contrived fitness function that measures complexity?


Topology andWeight Evolving Artificial Neural Networks (TWEANNs) are of two types. Direct and indirect encoding.

Direct
1. Binary connectivity matrix [crossover requires equal sized matrices, crossover has competing conventions problem], (Dasgupta and McGregor, 1992)


2. Nodes contain incoming and outgoing edge list (Pujol and Poli, 1997). [Subgraph swapping is possible] " Subgraph swapping is representative of a prevailing philosophy
in TWEANNs that subgraphs are functional units and therefore swapping them
makes sense because it preserves the structure of functional components.  However, we
cannot be sure whether the particular subgraphs being combined in PDGP are the right
ones to create a functional offspring."

Indirect 
1. Gruau's cellular encoding (I programmed this fully in C during my MSc thesis I remember now!). [Biased search space, utility of bias not known.]

Q(1) Is there a genetic representation that allows disparate topologies to cross over in a meaningful way? 

A1. Competing Conventions Problem (CROSSOVER OF DIFFERENT TOPOLOGY CONTROLLERS) 
[EROS SUFFERS FROM THIS CURRENTLY]
The biological solution is homology (lining up of equivalent genes) prior to crossover, done by RecA. Neat uses the HISTORICAL lineage knowledge to provide direct evidence of common ancestry from which true homology can be determined, to constrain crossover [Can this really work well, because there could have been functional divergence. Is this the best that can be done, is direct structural analysis really not possible? How does RecA work?]
" Tracking the historical origins requires very little computation. Whenever a new gene appears (through structural mutation), a global innovation number  is incremented and assigned to that gene. The innovation numbers thus represent a chronology of the appearance of every gene in the system."
" When crossing over, the genes in both genomes with the same innovation numbers are lined up. These genes are called matching  genes. Genes that do not match are either disjoint  or excess , depending on whether they occur within or outside the range of the other parent’s innovation numbers. They represent structure that is not present in the other genome. In composing the offspring, genes are randomly chosen from either parent at matching genes, whereas all excess or disjoint genes are always included from the more fit parent."

Q(2) How can topological innovation that needs a few generations to be optimized be protected so that it does not disappear from the population prematurely? 

A2. Protecting Innovation (NEW STRUCTURAL MUTANTS) with Speciation 
[EROS SUFFERS FROM THIS CURRENTLY]  " Frequently, adding new structure initially causes the fitness of a network to decrease" " By adding new genes to the population and sensibly mating genomes representing  different structures, the system can form a population of diverse topologies. However, it turns out that such a population on its own cannot maintain topological innovations. Because smaller structures optimize faster than larger structures, and adding nodes and connections usually initially decreases the fitness of the network, recently augmented structures have little hope of surviving more than one generation even though the innovations they represent might be crucial towards solving the task in the long run. The solution is to protect innovation by speciating the population" 




Adding new nodes and connections can reduce fitness suddenly before it's parameters have had a chance to optimise, so new topological additions must be protected/ This is achieved by fitness sharing based on genetic similarity [?]

Solution: Genomes are clustered on the basis of evolutionary similarity. Individuals in the same species must share fitness as in Goldberg and Richardson, 1987 (explicit fitness sharing).

NEAT ALGORITHM OVERVIEW 

1. Initialise population with a set of non-random MINIMAL initial topologies to reduce the number of parameters that have to be searched at the same time. [Instead of penalising larger networks like Zhang and Muhlenbein, 1993), they start with a minimal topology and grow it carefully.] 

Some parmeters from an example run below... 






2. Genetic Encoding [Designed to allow homologous crossover.] Linear representations of network connectivity.  



"Genomes are linear representations of network connectivity (Figure 2). Each genome includes a list of connection genes , each of which refers to two node genes  being connected. Node genes provide a list of inputs, hidden nodes, and outputs that can be connected. Each connection gene specifies the in-node, the out-node, the weight of the connection, whether or not the connection gene is expressed (an enable bit), and an innovation number , which allows finding corresponding genes (as will be explained below)."

[I do not like the fact that connectivity is not a self-organizing consequence of atom structures, which makes them fully PSS like.] 

MUTATIONS:
"In the add connection mutation, a single new connection gene with a random weight is added connecting two previously unconnected nodes. In the add node  mutation, an existing connection is split and the new node placed where the old connection used to be. The old connection is disabled and two new connections are added to the genome.  The new connection leading into the new node receives a weight of 1, and the new connection leading out receives the same weight as the old connection. This method of adding nodes was chosen in order to minimize the initial effect of the mutation." [Vera's idea as well, in our system. But I'm not sure this way of adding nodes is the best. What is the justification for it in our system? How to add new nodes in our system in order to make smooth operators?] 



IMPLICATIONS FOR EROS FROM NEAT.

1. Introduce historical markings to atoms. [We have an issue with edges which are currently encoded IN atoms, rather than as separate genes to which a separate historical marking could be assigned. Is this a problem? Consider the entities to which historical markings, and hence species definition, could be assigned, and perhaps how the definition of a species (and inter-individual distance) might itself be evolvable, because surely it is rather arbitrary how the 3 parameters that define distance is NEAT are chosen. COULD BETTER SPECIES EVOLVE OVER TIME IF THE DEFINITION OF SPECIES DISTANCE WAS ITSELF EVOLVABLE< OR NOT?

2. Initialize with a more minimal topology, e.g. only a sensor and motor atom with a linear transform. 

3. [Protect innovation] Introduce speciation based on historical similarity and niching (based on markings).  

4. Make the initial parameters of a new structural variant likely to be not too detrimental, e.g. [neutral addition of variation (e.g. insertion of an identity transform between sensor and motor atom). Atoms and their variation operators should be designed such that they have this property.] 

5. Increase parameter mutation rate (allowed by speciation!, not otherwise, see paragraph above.. 






Darwinian Neurodynamics (2): Perceptual Unsupervised Learning Quality, as a Guide to Action.

An idea for an intrinsic motivation function for child development based on quality of unsupervised learning. 

Compressibility (Schmidhuber) 

Short term goal. Produce a range of python functions for Alex that take in a senosirmotor time series one timestep at a time, and returns at the end a score for how well an unsupervised learning system (of various types) did, e.g. the quality of unsupervised learning. One such measure is naturally compressibility, which is how well the data can be reproduced given an informational bottleneck, so this could be done with an autoassociator by trying to reduce the size of the hidden layer to a minimum. The greater the compressibility the deeper the learning. Deep Belief Networks could also be used for this. In fact, at a deep level, the goal of unsupervised learning is to achieve maximal compression of the data. 

We've returned to Schmidhuber's compression progress as a measure of interestingness of an action. A game which is trying to compress an input vector s and is achieving greater compression rates over time, as a superior game to a game which is trying to compress input vector s' and is not improving. 

How do we measure the compressibility of the sensorimotor subset we're interested in then?