Brendan Fong, David Spivak and Remy Tuyeras cooked up a vast generalisation of neural networks in their paper Backprop as Functor: A compositional perspective on supervised learning.
Hereโs a nice introduction to neural networks for category theorists by Bruno Gavranovic. At 1.49m he tries to explain supervised learning with neural networks in one slide. Learners show up later in the talk.
with
Last time I gave Spivakโs โcorollaโ picture to think about such functors.
I prefer to view

A morphism
In the sheaf picture, this gives a map of sheaves over the space

But, unless you dream of sheaves in the night, by all means stick to Spivakโs corolla picture.
A learner
is a set, a parameter space of some maps from to . is the interpretation map describing the maps in . is the update map , the learning procedure. The idea is that is a map which sends closer to than the map did. is the request map .
Hereโs a nice application of
Morphisms
This follows from unpacking the definition of morphism in
The space-map
A surprising result from David Spivakโs paper Learnersโ Languages is
This will take some time.
Letโs bring some dynamics in. Take any polynmial functor
with space-map
We form a directed graph:
- the vertices are the elements of
, - vertex
is the source vertex of exactly one arrow for every , - the target vertex of that arrow is the vertex
.
Hereโs one possibility from Spivakโs paper for

Start at one vertex and move after a minute along a directed edge to the next (possibly the same) vertex. The potential evolutions in time will then form a tree, with each node given a label in
If we start at the green dot, we get this tree of potential time-evolutions

There are exactly
If we had started at the yellow dot we had obtained a labelled tree isomorphic to the subtree emanating here from any yellow dot.
We can do the same things for any morphism in
Now, we have a directed graph with vertices the elements
Once we have this directed graph on
In this way, the time evolutions starting at a vertex
But now, it is possibly that two distinct vertices can have the same
Right, I guess weโre ready to define the graph
In the case of learners, we have the target polynomial functor
Start with the free rooted tree
Hereโs the directed graph
-
vertices
correspond to the different -labelings of , one -labeled rooted tree for every map , -
arrows
if and only if is the rooted -labelled tree isomorphic to the subtree of rooted at one step from the root.
A learner
We saw that a learner
with
Hereโs what we have to do:
1. Draw the directed graph on vertices
2. Use the map

3. For each vertex draw the rooted
In this example the time-evolutions of the two green vertices are the same, but in general they can be different.

4. Find the vertices in

5. The vertex-set

A set-valued representation of
1. Take a set-valued representation of
And, for each directed arrow
2. The parameter set of our learner will be
3. The space-map
4. The update map
if
Thatโs all folks!
Changing the directions of all arrows in
Every topos comes with its own logic, so we have a โlearnersโ logicโ. (to be continued)
One Comment