If you read anything about deep learning neural networks, you often come across statements to the effect of 'we don't really know what is going on inside of these systems'. I think often times what they really mean is that they can't quantify a neural net in a set of rules that something like an expert system might use to try to reason. With the assumption that humans also have some set of rules inside of their head they iterate through to come to a decision.
So neural nets work very differently. The net learns from training data. And what it learns is a distributed representation, so the 'knowledge' is encoded in weight parameters throughout the network.
But people have come up with other approaches to trying to understand what is going on inside of the network. Many of these approaches are really about the same thing, manifold learning. The net is learning a multi-dimensional mapping function. And fortunately for us, most (perhaps all) of reality can be embedded into lower dimensional manifolds. Probably higher than 2 or 3 dimensions, but less than the dimensionality of the network itself.
A long time ago, Tomaso Poggio (Eugene McDermott Professor of Brain and Cognitive Sciences at MIT) promoted the idea of neural networks learning a nonlinear mapping function. And that they could learn any nonlinear mapping function. That was what they did. It's a very simple and concise way to think about them, about what they are doing, about what they are learning.
Let's have a little thought experiment. There are many different color spaces, vector spaces for representing what humans perceive as different colors. All of them have 3 dimensions. And if you would train a neural network to perceive colors like humans do, off of the human perceptual data, you end up with that net learning a multi-dimensional mapping to a 3 dimensional manifold.
So here we have an example of one small piece of 'reality' that maps to a 3 dimensional manifold. And of course experiments and studies that take a look at what is going on inside of the visual cortex in color vision (human neural modeling) come to similar conclusion. Even arriving at a 3 component model for color which consists of 1 channel that encodes luminance or lightness (the black and white channel if you want to simply think about it), and 2 different color axis opponents channels that encode the color information.
So, if you can wrap your mind around the concept of learning mapping functions into locally embedded manifolds, you can start to understand what these deep learning neural networks are really doing. It's no longer so mysterious.
So how could you try and visualize all of this. You've read the tales of Flatland, so you have some sense of what inhabitants of 1D or 2D worlds might think of discovering a 3D world. And you can try and extrapolate that into you being the creature that is exploring 4D or higher dimensions.
t-SNE is a very popular algorithm for visualizing multi-dimensional data in lower dimensions. t-SNE stands for t-Distributed Stochastic Neighbor Embedding. Geoffery Hinton's name is on the original paper, so you know it must be interesting.
Wow, that sounds just like MDS (multi-dimensional scaling) you might be thinking. Maybe the way to think about it is that t-SNE is a much better way to approach the old MDS problem space.
Gigory Serebryakov has an excellent tutorial on t-SNE that is available on the Learn OpenCV blog.
If you read it, you will be introduced to an alternative to Keras for specifying, training, and deploying a neural network. We'll be taking a look at the PyTorch alternative in later posts. It's also what Open AI is using, so again when we look at GPT-2 it's going to come up.
If you are interested in that original paper by Laurens van der Maaten and Geoffrey Hinton in 2008, check it out.
Anyone who knows me well probably also knows that i was using MDS to generate interactive perceptual maps of image databases in the 90s. Boy do i wish we had understood about t-SNE back when we were doing that research. Way better way to do the mapping to the lower dimensional display space for the perceptual mapping.