Part 5: Neo-ML: Two Ways to Recognise a Flower – An Introduction to Convolutional Neural Networks (CNNs)

A ruler and two rules, or four million numbers and a camera

I have now built a flower classifier twice.

The first time was while I was studying machine learning at Imperial College London. The model was a handful of lines of code, trained in a blink, and you could read its entire reasoning aloud in a few seconds.

The second time was this week. A convolutional neural network, nearly four million adjustable numbers, a few thousand photos. For fun, I showed it a picture of my dog and it told me, with 50% confidence, she was a tulip. I don’t see the likeness. For fun, an impression of what my CNN sees is shown below. I find it a bit creepy.

What my CNN say with 50% confidence, very disturbing...

Both models do the same job on paper: look at a flower, classify it. But they go about it in completely different ways, and the difference tells you most of what you need to know about choosing a model for real AI work. So let’s put them side by side, code and all.

Model one: measure first, then decide

The Iris dataset is the “hello world” of machine learning. It holds 150 iris flowers, 50 from each of three species: setosa, versicolor and virginica. For each flower, a botanist took four measurements with a ruler: sepal length, sepal width, petal length and petal width. The statistician Ronald Fisher made the dataset famous in 1936.

Notice what the model is given. Not a photo. Just four numbers per flower.

Here is the whole model, using a decision tree from the scikit-learn library.

from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier, export_text

iris = load_iris()
X_train, X_test, y_train, y_test = train_test_split(
    iris.data, iris.target, test_size=0.2, random_state=42, stratify=iris.target)

model = DecisionTreeClassifier(max_depth=2, random_state=42)
model.fit(X_train, y_train)

print(export_text(model, feature_names=iris.feature_names))
print(f”Test accuracy: {model.score(X_test, y_test):.1%}”)

Line by line:

  • load_iris() loads the 150 flowers and their species labels.
  • train_test_split holds back 20% of the flowers (30 of them) as test data the model never sees during training.
  • DecisionTreeClassifier(max_depth=2) asks for a tree that may ask at most two questions in a row.
  • fit does the learning. It searches for the measurement and the cut-off value that best separate the species.
  • export_text prints what the model learned, in plain text.

And this is what it prints:

|— petal length (cm) <= 2.45
|   |— class: 0
|— petal length (cm) >  2.45
|   |— petal width (cm) <= 1.65
|   |   |— class: 1
|   |— petal width (cm) >  1.65
|   |   |— class: 2

Test accuracy: 93.3%

That is the entire model. In English:

  1. If the petal is 2.45 cm long or less, it’s a setosa (class 0).
  2. Otherwise, if the petal is 1.65 cm wide or less, it’s a versicolor (class 1).
  3. Otherwise it’s a virginica (class 2).

Two rules, and it gets 28 of the 30 unseen flowers right. The first rule never misses, because setosa petals are much smaller than the others. The mistakes all come from versicolor and virginica, whose petal sizes overlap a little. The model also ignored the sepals completely. It worked out for itself that two of the four measurements were enough.

One honest footnote: the exact cut-off moves slightly depending on which flowers land in the training set. Train on all 150 and the second rule becomes 1.75 cm. The shape of the answer stays the same.

Model two: look, and learn what matters

Now take away the botanist and the ruler. All we have is photographs: 3,670 of them, sorted into five folders for daisies, dandelions, roses, sunflowers and tulips. And it’s the folder names that act as the image labels.

A photo, to a computer, is a grid of numbers. Each image here is resized to 180 by 180 pixels with three colour values per pixel. That is 97,200 numbers per flower, against the Iris model’s four. And no single one of those numbers means anything. Pixel 4,012 being a bit red tells you nothing about roses.

A close-up image of two white roses with yellow centers, surrounded by green foliage, alongside a color palette showing various shades of yellow and white.

So the model has to do two jobs. First work out what to look for, then decide. The tool for that is a convolutional neural network, or CNN.

A short detour: what is a CNN?

In 2012, a small team from the University of Toronto entered the ImageNet challenge, an annual competition in which software had to recognise objects in photographs across 1,000 categories, learning from about 1.2 million labelled images. Alex Krizhevsky, Ilya Sutskever and their supervisor Geoffrey Hinton submitted a CNN that became known as AlexNet.

It didn’t just win. Its error rate was about 15%, against about 26% for the runner-up. In a contest where teams usually fought over a point or two, that was a different league, and within a couple of years almost everyone in the field had switched to the same approach. The current AI boom is usually dated from that result.

The idea itself wasn’t new. Yann LeCun had CNNs reading handwritten digits on bank cheques in the 1990s. What changed by 2012 was a huge labelled dataset and GPUs fast enough to train on it. The breakthrough was as much about data and hardware as about the model.

So what is it? A CNN is a neural network built for images, and it rests on three ideas.

  1. Filters. A filter is a tiny window, often 3 by 3 pixels, that slides across the whole image looking for one simple pattern, such as a vertical edge. Wherever it finds the pattern, it lights up. The sliding is the “convolution” in the name.
  2. Layers. Filters are stacked in layers, and each layer looks at the output of the one before. The first finds edges and colours. The next combines edges into textures and curves. The next combines those into parts, such as a petal. It is a little like reading: strokes make letters, letters make words, words make meaning.
  3. Learning. Nobody designs the filters. They start as random numbers, and training nudges them, photo by photo, until they detect patterns that help tell the classes apart.

That third point is the big one. In the Iris model a botanist chose what to measure. In a CNN, the filters are the measurements, and the network works them out for itself.

Here is mine, written with Keras.

model = Sequential([
  layers.Input(shape=(180, 180, 3)),
  layers.Rescaling(1./255),
  layers.Conv2D(16, 3, padding=’same’, activation=’relu’),
  layers.MaxPooling2D(),
  layers.Conv2D(32, 3, padding=’same’, activation=’relu’),
  layers.MaxPooling2D(),
  layers.Conv2D(64, 3, padding=’same’, activation=’relu’),
  layers.MaxPooling2D(),
  layers.Flatten(),
  layers.Dense(128, activation=’relu’),
  layers.Dense(5)
])

Read it top to bottom, because that is the route a photo takes.

  • Input and Rescaling take the photo in and shrink the pixel values from 0 to 255 down to 0 to 1, which networks learn from more easily.
  • Each Conv2D layer slides a set of small 3 by 3 windows, called filters, over the image. Each filter hunts for one pattern. The first layer finds edges and patches of colour, the second combines those into textures and curves, the third into things like petals and flower centres.
  • Each MaxPooling2D halves the image size, keeping only the strongest signals.
  • Flatten and the two Dense layers weigh up everything that was found and produce five scores, one per flower. Highest score wins.

Here is the part that matters for this comparison. Nowhere in that code is there a word about petals, colours or stems. The code only describes the shape of the model. Everything it knows about flowers is learned during training and stored as 3,989,285 numbers.

The convolution layers are doing the botanist’s job. They are deciding what is worth measuring.

For the curious: counting the parameters

Keras will count the numbers for you. Run model.summary() and the last lines read:

 Total params: 3,989,285 (15.22 MB)
 Trainable params: 3,989,285 (15.22 MB)
 Non-trainable params: 0 (0.00 B)

  • Total params is every adjustable number in the model.
  • Trainable params are the ones training is allowed to change. Here that is all of them.
  • Non-trainable params are numbers that are locked. There are none, because this model was trained from scratch.
  • 15.22 MB is the memory they take up. Each parameter is stored in four bytes.

Where do they all live? Not where you might expect.

LayerParameters
Conv2D, 16 filters448
Conv2D, 32 filters4,640
Conv2D, 64 filters18,496
Dense, 128 units3,965,056
Dense, 5 outputs645

The three convolution layers, which do all the seeing, account for well under 1% of the total. Over 99% sit in one dense layer that weighs up the evidence. Filters are cheap because the same small window is reused across the whole image.

And for all that, four million parameters is small by today’s standards. No GPU necessary: this model trained on my laptop.

It works, up to a point. The first version of this model typically reaches around 60% on photos it hasn’t seen, and it improves once you add a couple of standard fixes for overfitting. But ask it why it chose “rose” and all it can give you is a confidence score. And because it only knows five answers, everything in the world is one of five flowers. Including my dog now nicknamed Tulip.

Side by side

 Iris decision treeFlower CNN
What goes in4 measurements taken by a person97,200 raw pixel values
Who chose what to measureA botanistThe network, during training
Training examples120 flowers2,936 photos
What the model stores2 rules3,989,285 numbers
HardwareAny laptop, instantlyA laptop, more slowly; no GPU needed at this size
Explanation for an answer“The petal is under 2.45 cm”A confidence score
Works on a raw photoNoYes

This is not a fair fight, and it isn’t meant to be. They are different datasets and different problems: three species against five, measurements against photos. The accuracy figures can’t be compared.

What can be compared is where the hard work happens. With Iris, a human had already done the difficult part by deciding that petal size mattered and measuring it. The model only had to draw two lines. With the CNN, nobody told it where to look, so it had to learn that too. That is why it needs twenty-four times the examples and millions of times the parameters.

Pros and cons

The rule-based model

For

  • You can read it. A rejected item comes with a reason a person can check.
  • It is easy to verify. It’s just measurements and maths, so anyone with a ruler and the two rules can confirm an answer by hand.
  • It needs very little data. 120 examples were plenty.
  • It trains in an instant and runs on anything.
  • There is very little to go wrong, and when it does go wrong you can see where.

Against

  • Somebody has to measure the right things first. On a production line that means a sensor, a calibrated camera or a person with a ruler.
  • It only works when the decision can be written as rules on those measurements.
  • It can’t cope with raw, messy input such as a photo taken at an odd angle in poor light.

The CNN

For

  • It works directly on images. No one has to decide in advance what to measure.
  • It handles variety that no rulebook could cover: angle, lighting, background, shape.
  • The same approach transfers to other visual problems, from cracked bottles to medical scans.

Against

  • It is hungry for labelled examples, and labelling is slow, costly work.
  • It needs far more compute to train. This small one ran on a laptop, but larger models need a GPU.
  • It can’t explain itself beyond a score, which matters when someone asks “why was this rejected?”
  • It fails in strange ways, and confidently. See: dog, tulip.
  • It needs watching after it goes live, because the world it was trained on keeps changing.

So which one is better?

Neither. It’s the wrong question.

The right question is: can you measure the thing that matters?

If you can, and the decision can be written as a rule, use the rule. It is cheaper to build, cheaper to run, and it can explain itself. A fill level on a bottling line is a height against a mark. You don’t need four million parameters to read a ruler.

If you can’t, because what matters is buried in pixels and varies every time, that is where a network earns its keep. Nobody can write a rule for “looks like a rose” or “looks cracked”.

Plenty of real systems use both. A camera and some image processing take the measurement, and a simple rule makes the call. Deep learning comes in only for the part that won’t reduce to a measurement.

AI wasn’t born from deep learning, and sledgehammers don’t crack nuts. The Iris dataset is ninety years old and a two-rule tree is still the right answer to its own problem. The best model isn’t the newest or the biggest. It’s the one that works for your use case.

Computer Vision: Just Point a Camera at It. Right?

Over the weekend my girlfriend was busy. So what’s a guy to do? This guy built a CNN image recognition system and trained it on five types of flower. With over 3,000 flower images, it worked. Point it at a sunflower and yes, it predicted a sunflower. Same with roses, tulips, dandelions and daises.

But what flower is my dog? Yes, I pointed my model at an image of my dog sat upright. The model predicted with 49% confidence my dog is a tulip. My model isn’t broken. It only knows 5 answers, so everything in its world is one of five flowers. It answered the question it was built for, not the one I asked. This is the problem Marco has just brought home to Castellan Wines – our fictitious winery.

Diagram illustrating a quality control system for bottles on a conveyor belt, showing inspection points for fill level, chips, cracks, contamination, and crooked labels with data on good and defective items.

“It all just works”

Castellan Wines has a good problem. Sales have grown faster than the bottling hall, and the manual inspection that coped with a quieter line no longer does. It is still done by eye. It is slow, it varies by shift, and a bad bottle reaching a retailer costs far more than the bottle is worth.

CEO Marco has seen the answer. He came back from an AI conference with a tote bag and a conviction: you point cameras at the bottling line, the AI learns what a good bottle looks like, and it all just works. He watched it happen on a stand. And he was filled with the promise of AI.

The demo was real. It was also a demo: one bottle shape, perfect lighting, and defects chosen to be found.

So Clare has a one-line brief, “build me a defect detection model”. Her harder job, is to deliver AI Reality. She is Castellan’s data scientist, and she is honest about being new to computer vision and convolutional neural networks (CNNs). So she does the sensible thing. She experiments first and writes the blueprint second, and she organises both around three questions.

Question one: what decision are we supporting?

Marco’s brief is one model, pass or fail. Clare spends a morning on the line with the bottling line inspectors and writes down what they check.

They look for damage: is there a chip or a crack, and where? They check the fill level, which is a measurement. They check the cap is sitting square. And they check the label: the right one, straight and readable, which is reading text and checking position.

Four different jobs. Roll them into one pass/fail and QA gets a red light with no idea why.

Then there’s the camera. Clare props her iPhone beside the line and films a few minutes. Cracks show up reasonably well. The fill line doesn’t. Through dark, reflective glass, reflections can move the apparent liquid line more than any real variation does.

A setup good enough to spot a cracked bottle is not automatically good enough to measure one. I wrote about this in Now You See It, Now You Don’t: a model can only work with what the camera lets it see.

And as for the data, which is Charlie’s department. Castellan has a year of QA logs and almost no labelled images. Defects are rare, which is good news for the winery and awkward for anyone training a computer vision model.

So the first page of the blueprint doesn’t say “quality model”. It says four tasks, each with its own evidence, its own camera requirement, and its own answer.

Question two: do we need machine learning at all?

Here’s the answer nobody puts on a conference slide. For fill level and cap alignment, no machine learning.

Clare gets there by experiment. Her first instinct is Marco’s: collect images, train a network. Then she looks at what she would be asking it. Is the liquid line above or below a known mark? Is the cap sitting square?

Those are questions about where an edge is, and engineers have had reliable ways of finding edges in images for decades.

So she builds a short, old-fashioned pipeline in an afternoon. Capture the frame, remove the noise, boost the contrast, find the edges, compare the liquid line against a calibrated reference, and pass or fail.

The order matters. On her first attempt she boosts the contrast before removing the noise, and amplifies the very speckle she wanted rid of.

No training data. No GPU. Nothing to retrain. And when a bottle is rejected, the reason is a measurement a supervisor can check with a ruler, not a confidence score.

It comes with two honest conditions. It only works once the lighting is fixed, most likely with a light behind the bottle so the liquid line shows as a clean edge. And a fixed reference needs recalibrating whenever the bottle format or the lighting changes. That is a job for a technician with a checklist, not a data scientist with a GPU.

Marco is not thrilled. He was promised AI. Clare’s answer is that you can crack a nut with a sledgehammer, but you don’t get much nut. He’s not impressed.

Where the environment is controlled and the decision can be written as a rule, the classical approach isn’t the budget option. It’s the right approach every time.

Question three: where does deep learning earn its place?

Damage. Chips, cracks and contamination come in every shape, in any position, on glass that reflects everything around it. Clare can’t write a rule for “looks cracked”. This is the kind of uncertainty neural networks are good at, so this is where Marco gets his AI.

Even then, most of the blueprint is restraint.

She doesn’t start from zero. Defects are rare, so there will never be enough examples to train a network from scratch. The blueprint starts with a model that has already learned to see from millions of general images, and adapts it.

It’s like hiring an experienced inspector from another industry. They already know how to look, and you only have to teach them what a bad bottle is. Dark glass is not much like holiday photos, though, so the adapting has to go deeper than swapping the last layer.

She picks speed where the line can afford it. The line doesn’t stop, so the blueprint specifies a fast single-pass detector over a slower, more careful two-stage one. That’s normally a risk with small defects.

The camera sits at a fixed distance, so every bottle arrives the same size in the frame, which helps. A hairline crack is still a hairline crack. So the blueprint also names the evidence that would justify the heavier model: cracks missed in testing.

She decides which mistake is worse. A false alarm sends a good bottle to a human for a second look. A miss sends a cracked bottle to a customer. Those are not equal, so the threshold is set to over-report, and borderline cases go to a person.

Charlie, (our data engineer in this story), spots the catch. Defects are rare, so even a small false-alarm rate means most flagged bottles are perfectly good. Make the system too cautious and the inspectors spend their shift re-checking good bottles. The blueprint has to state both numbers: the misses Castellan will tolerate, and the false alarms the bench can absorb in a shift.

And she respects the boring details, two of which she learns the hard way.

The first is labelling. A hairline crack is thin and diagonal, so a box drawn round it is mostly good glass. Clare and Charlie mark up the same set of images separately and find they have drawn the boxes differently almost every time. Unless the people doing the labelling agree how to draw it, the model learns from an argument.

The second is her proudest experiment. She films the line for an afternoon, splits the frames at random into training and test sets, and gets a score that would look wonderful on a conference slide.

Charlie points out that consecutive frames are nearly identical. Her model was being tested on pictures it had practically seen. She splits by production batch instead, and the score comes back down to earth.

Neither detail came up on the conference stand, and there’s no reason it would in ten minutes. Both decide whether an accuracy figure means anything.

The blueprint doesn’t say whether Castellan buys this or builds it. Mature products exist for damage detection and one may well be the right choice. What Clare’s experiments give Marco is the list of questions to ask whoever supplies it.

One line, three answers

Marco asked for one model. The blueprint gives him three answers.

Damage gets deep learning, adapted from a pretrained model, because it is too variable to write as rules. Fill level and cap alignment get classical image processing, once the lighting is sorted, because they are geometry against a known reference.

Labels wait. Reading text is something you can buy off the shelf. Nobody has yet shown that a camera on this line can see a curved, moving label well enough to read it.

It isn’t what Marco heard at the conference. It is something he can cost, schedule and check.

Computer vision is not black magic. It’s a chain of engineering decisions, and most of them are about the camera and the data, not the model. Use the simplest thing that works, and step up only when the evidence tells you to.

There’s one question Clare hasn’t answered, and Marco has already asked it: how do we know it works, and how do we know it keeps working? Lighting changes, new bottle formats arrive, cameras get knocked. A vision system is not fit and forget. That’s the next post.

Reality has to be built in, not bolted on.

Part 4: Neo-ML — More Isn’t Better. A Rule for Tokenomics

A diagram illustrating a neural network architecture, featuring gauges displaying parameters, tokens per inference, and GPU load, labeled as 'Solution For The Problem Being Solved'.

Early in my career, a Yoda type IT Director handed me a principle I’ve never forgotten: “Solution for the value of the problem being solved.” Plain English for “don’t over-engineer — you’ll blow the ROI.” Thirty years later, it turns out to be exactly the right lens for thinking about LLMs and Tokenomics.

As people, we’re almost programmed to believe bigger is better. More is good. Faster is cool. It’s an instinct baked in early — the bigger engine, the higher spec, the longer list of features. Thirty years around technology built on exactly that assumption leaves a mark — after many lessons learnt, today I always stop myself before reaching for the bigger spec.

But logic provides a different conclusion. And like everything in this series, it all depends on the data. More horsepower doesn’t mean better answers.

This week, I was advising a customer who wanted a 2.8T parameter LLM for just sixty concurrent users. I had to explain why bigger wasn’t better. A bigger brain doesn’t give you better answers if the data doesn’t demand a bigger brain to find them. There was no point speccing an eight-way GPU server when the workload never needed that much horsepower. They settled on a 3B parameter model — good enough, without paying for capacity nobody was going to use.

And the advice was sound. The customer couldn’t afford an eight-way GPU server and the ongoing operational costs that come with running one. A two-way RTX 6000 server was good enough for the job, with headroom to spare. What they hadn’t understood going in was the overhead that comes with a model at that scale: the infrastructure, the hosting costs, the operational weight of something built for a different tier of requirement entirely. A frontier-scale model isn’t wrong — it’s built for a different job, one with a different data profile and a different scale of demand. Sixty concurrent users wasn’t that job.

It’s the same lesson I ran into on a much smaller scale — on my own laptop, with a much smaller neural network. And the numbers make the argument better than any analogy can.


In the last post we built a working ANN — eight inputs, two hidden layers of sixteen neurons each, 433 trainable parameters — to predict whether someone works in Engineering or Education from age, state, income, and political leaning. Test accuracy came in at 65%, with a confusion matrix that clearly favoured Education over Engineering. The obvious next move, when a network underperforms, is to give it more room to think. So that’s exactly what I tried.

I doubled the width of both hidden layers, from sixteen neurons to thirty-two. Same eight inputs, same activation functions, same optimiser, same loss function, same training data. The only thing that changed was the size of the network itself. Parameters jumped from 433 to 1,377 — more than triple. Memory footprint went from 1.69 KB to 5.32 KB, over three times the size for the same job. Every weight update during training now had three times as many numbers to shift.

Test accuracy came in at 65%.

Not roughly the same. The same. The larger network, with three times the parameters and three times the memory footprint, made exactly the same proportion of correct predictions on exactly the same test set as the smaller one. The confusion matrix barely shifted — still cautious about calling Engineering, still over-predicting Education. Tripling the network’s capacity to represent patterns bought nothing, because the extra capacity had nothing new to work with. The training data was still 200 people, still whatever class imbalance was baked into it, still the same eight features. More neurons gave the network more ways to represent the same limited signal — not a stronger signal to represent.

This is the uncomfortable bit for anyone whose instinct is to solve underperformance with scale. Every one of those extra 944 parameters had to be initialised, computed across, and adjusted on every one of those fifty epochs. That’s real compute, real memory, real time — spent finding nothing that the smaller network hadn’t already found. If this were a production model running on GPU infrastructure rather than a laptop experiment, that’s a bill with a third more zeroes on it for a result you could read off the smaller model for free. Bigger didn’t just fail to help. It cost more to fail by exactly the same margin.


The Numbers Don’t Lie

Two examples, wildly different scales — a laptop experiment with a few hundred parameters, a production LLM decision with billions — and the same result both times. Tripling my network’s size didn’t move accuracy by a single percentage point. An eight-way GPU server wouldn’t have made my customer’s answers any better either; it would just have made them more expensive to get. In both cases, the ceiling was never the model. It was set by the data and the workload underneath it, long before anyone chose an architecture.

And with LLMs, the tokenomics make this unavoidable. Every parameter you don’t need is a token you’re paying to process, a millisecond of latency you’re adding, and an infrastructure cost that compounds at scale. The bill for unnecessary capacity isn’t a one-off — it runs with every inference, every query, every user session. Right-sizing isn’t just good engineering; it’s the only financially rational choice.

This is the bit the industry doesn’t lead with, because “buy bigger” is a simpler pitch than “go and understand your data first.” But bigger only helps when there’s more signal for the extra capacity to find. When there isn’t, you’re not buying performance — you’re buying a heavier bill for the same answer. The instinct to reach for more is human, and understandable. The discipline is asking first — does the data actually need it?

“Solution for the value of the problem being solved.”

Both the 16-neuron and 32-neuron runs are up on Kaggle — same data, same seed, side by side. The numbers make a more convincing argument than prose can. If you want to see exactly what “same result, three times the cost” looks like in a confusion matrix, that’s where to look.

433 parameters

1377 parameters

In the next post we stop scaling and start changing shape — moving from dense layers to convolutional ones, and what a network actually needs to look at images rather than rows of numbers. That’s where Neo-ML starts to earn its name.

In the next post we stop scaling and start changing shape — moving from dense layers to convolutional ones, and what a network actually needs to look at images rather than rows of numbers. That’s where Neo-ML starts to earn its name.

Part 3: Neo-ML: Under the hood – ANN in Code

Artificial Neural Network (ANN) by example

Schematic of a neural network with input features including age, state, income, and politics leading to two hidden layers and an output layer predicting class based on dropout connections.

As kids growing up in the 70s with no internet and no video games, we explored the world around us. Our curiosity fueled adventure and discovery. For me, I needed to understand how things worked. I remember one day in my bedroom having the thought, “I wonder what electricity looks like?” So I took the back off a plug and plugged it into the wall socket. I didn’t get to see electricity, but I certainly got to feel it. My right arm jolted as 240 volts held me pinned to the wall plug. Finally, with some effort, I grabbed my right arm with my left and pulled myself away. Of course, I never told my parents.

Growing up in an age of childhood freedom gave me curiosity. And that same curiosity is why this blog exists. I’m not going to walk through a neural network diagram with dots and lines. In this blog. Instead I’ll walk through the code of a simple ANN. Don’t worry, it’s not shocking.


In the last two posts we built up the ideas. A single artificial neuron: weighted inputs, a bias, an activation function, a decision. Then a network of them: layers stacked so that each one hands its output to the next, learning boundaries no single neuron could draw alone. We talked about backpropagation, loss functions, and why depth changes what’s possible.

Now let’s get under the hood.

The code below is a real, working neural network — not a toy illustration, not pseudocode. It’s written in Python using TensorFlow and Keras, which are the tools most practitioners actually reach for. The problem it solves is deliberately simple: given a person’s age, state, income, and political leaning, predict whether they work in Engineering or Education. Two possible answers. One network to find the boundary between them.

That’s a binary classification problem — the same category as “will this machine fail in the next 24 hours?” from the factory floor. Same structure, different data.


Step 1: The Data

Python code snippet for loading datasets using Pandas, including reading training and testing data from CSV files and defining column names.

Two hundred people for training, forty held back for testing. Each row is one person. The Sector column is the answer — 1 for Engineering, 0 for Education. Everything else is a feature: the inputs the network will learn from.

Look at the numbers in the data and you’ll notice something. Age isn’t stored as 32 or 45 — it’s stored as 0.32 or 0.45. Income isn’t 82,000 — it’s 0.82. Everything has been scaled down onto a comparable footing, roughly between 0 and 1. This is data normalisation, and it matters more than it sounds. Without it, the raw income figure — a number in the tens of thousands — would dominate every weighted sum in the network simply by being numerically large, regardless of whether income is actually the most informative feature. Data normalisation levels the playing field so the network can decide for itself what matters.

The state and political leaning columns work differently. A state isn’t a number on a scale — Oregon isn’t “more” than Maine in any meaningful sense. So instead of encoding state as a single column with values 1, 2, 3, each state gets its own binary column: State_OR, State_ME, State_OK. A person from Maine gets a 1 in State_ME and a 0 everywhere else. This is called one-hot encoding, and it’s the standard way of feeding categorical data into a neural network without accidentally implying an order that doesn’t exist.


Step 2: The Architecture

Code snippet showing the architecture definition of an Artificial Neural Network (ANN) using TensorFlow and Keras, including layers, activation functions, and dropout.

Stop for a second. This is it. This is the neural network. Not a diagram. Not a concept. Five lines of Python code that define the entire structure of an ANN — the layers, the neurons, the activation functions, everything. When people talk about “building a neural network,” this is what they mean. Let’s walk through each line.

Input(shape=(8,)) — the doorway. Eight features come in: age, three state columns, income, three political leaning columns. This layer doesn’t compute anything; it just tells the network what shape to expect.

Dense(16, activation=’relu’) — the first hidden layer. Sixteen neurons, each one connected to all eight inputs. Each neuron takes a weighted sum of those eight values, adds a bias, and passes the result through ReLU. If the result is positive, it passes through unchanged. If it’s negative, it becomes zero. Sixteen different weighted combinations of the same eight inputs, each one learning to notice something slightly different about the data.

Dropout(0.2) — this one doesn’t appear in most diagrams, but it’s doing something important. During training, it randomly switches off 20% of the neurons in the previous layer on each pass. Not the same 20% every time — a different random selection each time. This sounds counterproductive. Why would you deliberately break your own network? Because it forces the network to learn redundant, overlapping representations rather than leaning too heavily on any single neuron. A network that can only function when every neuron is present is a fragile one. Dropout is the training equivalent of practising a skill with one hand tied behind your back so that when both hands are free, you’re stronger for it. At prediction time, Dropout switches off entirely — all neurons active, full strength.

Dense(16, activation=’relu’) — a second hidden layer, identical in structure to the first. Its inputs are the outputs of the first hidden layer, not the raw data. This is where depth earns its keep: the second layer isn’t looking at age and income directly, it’s looking at whatever the first layer learned to notice about age and income. Abstractions built on abstractions.

Dense(1, activation=’sigmoid’) — the output layer. One neuron, because there are two possible answers and one probability is enough to express both. Sigmoid squashes the result to a number between 0 and 1. Above 0.5, the network says Engineering. Below 0.5, it says Education. The closer to the extremes, the more confident the prediction.

The whole network has 433 trainable parameters — 433 individual weights and biases that start as random numbers and will be adjusted, thousands of times, until they mean something. Think about that for a moment. Two hidden layers of 16 neurons each, connecting 8 inputs to a single output, and the entire intelligence of this network — everything it knows about predicting whether someone works in Engineering or Education — lives in 433 numbers. The model summary tells you the memory footprint too: 1.69 KB. Not megabytes. Not gigabytes. One point six nine kilobytes. A text message takes up more space. And yet those 433 numbers, tuned correctly, can make predictions a human couldn’t easily articulate as a rule.


Step 3: Compile — Choosing the Learning Rules

Code snippet showing a summary of a model and its compilation using 'adam' optimizer and 'binary_crossentropy' loss function in Python.

Before training can begin, the network needs two things: a way to measure how wrong it is, and a strategy for getting less wrong.

binary_crossentropy is the loss function. For a binary classification problem — two possible outcomes — this is the standard choice. It measures the gap between what the network predicted and what the correct answer actually was, and it comes down hardest on predictions that were confident and wrong. A network that says “90% sure it’s Engineering” when it’s actually Education gets penalised far more than one that hedged at 55%.

adam is the optimiser — the strategy for adjusting the weights after each error is measured. Adam is an adaptive optimiser, meaning it doesn’t nudge every weight by the same amount. It keeps track of how each weight has been moving and adjusts its step size accordingly. Weights that have been oscillating get smaller nudges; weights that have been consistently moving in one direction get larger ones. In practice, Adam converges faster and more reliably than plain gradient descent for most problems, which is why it’s become the default starting point for almost everyone.


Step 4: Training — Being Wrong, Repeatedly, on Purpose

Code snippet demonstrating the training of a machine learning model using the fit method with parameters for training data, validation split, number of epochs, batch size, and verbosity.

This is where the learning happens. model.fit runs the training loop.

epochs=50 means the network will see the entire training dataset fifty times. Each pass through the data is one epoch. On each pass, it makes predictions, measures its error with the loss function, and uses backpropagation to work out how every one of those 433 weights contributed to that error. Then Adam nudges each weight in the direction that reduces it.

batch_size=16 means the network doesn’t wait to see all 200 training examples before updating its weights. It processes 16 at a time, updates, processes the next 16, updates again. This is called mini-batch gradient descent, and it’s faster and often more stable than waiting for the full dataset.

validation_split=0.2 holds back 20% of the training data — 40 people — as a validation set. The network never trains on these; they’re used purely to check, after each epoch, whether the network is actually learning something general or just memorising the training data. Watch the training output and you’ll see two accuracy figures per epoch: training accuracy and validation accuracy. If training accuracy climbs while validation accuracy stalls or falls, the network is overfitting — learning the training data by heart rather than learning the underlying pattern.

Here’s what the first few epochs look like:

Text output displaying training progress of a machine learning model across epochs with metrics including accuracy, loss, and validation loss.

Epoch 1: the network is barely better than a coin flip. The weights are random, the predictions are noise. By epoch 40, training accuracy has climbed to 71%. The network is learning. The validation accuracy tells a more cautious story — it peaks around 50%, suggesting the network is finding real patterns but the problem is genuinely hard with only 200 training examples. More data would help.


Step 5: Evaluate — Honest Accounting

Python code snippet demonstrating model evaluation, including loss and accuracy calculations, prediction generation for a confusion matrix, and printing of classification report for binary classification.

Test accuracy comes in at 65%. On 40 unseen people, the network gets 26 right. That’s better than chance, but the classification report tells the more interesting story:     

A classification report displaying precision, recall, f1-score, and support for Engineering and Education categories.

When the network predicts Engineering, it’s right 93% of the time — high precision. But it only catches half the actual engineers — low recall. It’s cautious about calling Engineering, so it misses a lot of them. Education is the mirror image: it catches almost everyone who works in Education (93% recall), but half its Education predictions are wrong (50% precision).

This is exactly the precision-recall trade-off we touched on with the factory floor. Accuracy alone — 65% — doesn’t tell you this. The confusion matrix does:

A confusion matrix displaying values in a 2x2 format with counts: [[13, 13], [1, 13]].

Thirteen engineers correctly identified. Thirteen engineers incorrectly called Education. One educator incorrectly called Engineering. Thirteen educators correctly identified. The network has a bias toward predicting Education. Understanding why — whether it’s the class balance in the training data, the features available, or the architecture — is where the real diagnostic work begins.


Step 6: Prediction — The Network in Use

A screenshot of Python code that demonstrates a function to collect user information such as age, state, income, and political leaning, and then predict a sector based on the input data.

The network is trained. Now it earns its keep.

A new person walks in: age 32, from Maine, income $82,000, politically moderate. The code normalises those inputs exactly as the training data was normalised — age becomes 0.32, income becomes 0.82 — and feeds them through the network. The 433 weights, now tuned through 50 epochs of training, do their work. The output neuron returns a single number: 0.7066.

Above 0.5. The network says: Education.

That number — 0.7066 — isn’t a certainty. It’s a probability. The network is saying “I think there’s about a 71% chance this person works in Education.” The threshold of 0.5 is a choice, not a law. In a real application, you might raise it to 0.7 or 0.8 if the cost of a wrong prediction is high. Lower it if missing a true positive is the bigger risk. The threshold is yours to set; the probability is the network’s to produce.


What Just Happened

Six steps. One hundred and something lines of Python. A network that started knowing nothing — random weights, random predictions — and ended up with a view of the world encoded in 433 numbers that no human chose or wrote down.

The architecture was ours: eight inputs, two hidden layers of sixteen neurons each, one output. The activation functions were ours: ReLU in the hidden layers, sigmoid at the output. The loss function and optimiser were ours. But the weights — the actual knowledge, the thing that makes a prediction possible — those were discovered, not designed. The network found them by being wrong thousands of times and adjusting.

That’s the idea this whole series is built on. Not a model we wrote. A model that wrote itself, in a language of numbers, from nothing but examples and error.

In the next post, we’ll dive into why more parameters isn’t always best. And like with everything, bigger takes up more memory and more GPUs. So choose wisely.

Part 2: Neo-ML: Machine Learning Evolved — Feedforward Networks

Click here for – Part 1: The Artificial Neuron (Node)

An illustration of a robotic arm connected to a neural network interface, displaying numeric log data and an alert notification, set against a blueprint background that depicts cars on an assembly line.

Picture a modern manufacturing plant, bristling with IoT sensors. Temperature readings in the hundreds. Vibration readings out to several decimal places. Every few seconds, a live feed of numbers, feeding into a system whose only job is to answer one very important question: “Is a machine about to fail?”

Feed those numbers into a neural network, train it on enough historical data, and it learns to answer that question — reliably enough that plants genuinely use systems like this to schedule maintenance before a breakdown rather than after one. Which raises the obvious question. How does a network built from nothing but weighted sums and simple functions learn something as specific as “these vibration patterns, at this temperature, mean trouble in the next 24 hours”? Nobody wrote that rule down for it. Where does that knowledge actually come from?

To answer that, we need to go back to a puzzle that looks nothing like a factory floor at all.

Back to School

Miss Smith once set the class a problem she knew none of us could solve. Four dots on a grid, two black, two white, arranged so that no single straight line could separate the colours. “Draw me one line,” she said, “that puts all the black dots on one side and all the white dots on the other.” We tried. We failed. She let us fail for a good five minutes before she told us it was impossible — not hard, impossible — and that the only way to solve it was to stop drawing one line and draw two lines instead. I didn’t know it at the time, but I’d just met XOR, decades before I’d hear the name.

XOR — “exclusive or” — is about as simple as logic gets. It’s true when exactly one of two inputs is true, and false otherwise. A child can learn the rule in ten seconds. And yet this is precisely the problem that stopped the Perceptron dead in 1969. Minsky and Papert proved, with unarguable maths, that a single artificial neuron — one weighted sum, one activation function, one decision boundary — could never learn XOR. The four points of the problem simply cannot be separated by one straight line, in exactly the same way Miss Smith’s dots couldn’t be. The field took the result badly. Funding dried up. The first AI winter set in, and it lasted the best part of a decade.

The way out, when someone finally found it, was almost insultingly obvious in hindsight: if one line isn’t enough, use two. So if one neuron isn’t enough, use more than one — and arrange them in layers. That single idea is also the answer to the factory floor question. A vibration-and-temperature failure signature isn’t separable by one straight line any more than XOR is. It needs a network, not a neuron.

From one neuron to a neural network

A single artificial neuron, as we covered last time, takes some inputs, weights them, sums them, and passes the result through an activation function. It draws one boundary. Stack several neurons side by side, and feed all of their outputs forward into another neuron, and something changes qualitatively. Each neuron in that first layer can learn its own boundary — its own “line” — and the neuron receiving all of those outputs can combine them into a shape no single line could draw on its own. Two lines, combined correctly, can box in XOR’s four points perfectly.

This arrangement is called a feedforward neural network. Data enters through an input layer, where each neuron corresponds to one feature — a pixel value, a sensor reading, a temperature. It’s not a computational layer so much as a doorway. From there, the data passes through one or more hidden layers, where the actual work happens: each neuron takes a weighted sum of everything the previous layer handed it, adds a bias, and squashes the result through an activation function, exactly as we walked through with a single neuron last time. “Feedforward” simply describes the traffic rules — information only ever moves forward, layer to layer. Finally, an output layer produces the answer in whatever shape the problem demands: one neuron for a yes/no decision, ten neurons if you’re identifying a handwritten digit.

When every neuron in one layer connects to every neuron in the next, you’ll hear it called a “fully connected” or “dense” layer. Remember that phrase — it matters later in this series, because not every network wires its layers this way.

How it learns

None of this is any use if the weights are wrong, and at the start, they are — set randomly before training begins. The network makes a prediction, a loss function scores how wrong that prediction was, and backpropagation works backward through the network asking, for every single weight, “if I nudged you slightly, would the error go up or down?” Then it nudges every weight a small step in whichever direction reduces the error. Do that across enough examples, enough times, and the weights settle into values that actually mean something.

The choice of loss function matters more than people expect. Predicting a continuous number — a machine’s remaining useful life — usually calls for mean squared error, which punishes large mistakes disproportionately by squaring them. Classifying something into categories — will it fail or won’t it — calls for cross-entropy, which measures the gap between two probability distributions and comes down hardest on predictions that are confident and wrong.

Nobody told the neural network machine vibration readings above a certain threshold, combined with temperature, predict a bearing failure. It found that out for itself, by being wrong thousands of times and adjusting. It’s brute force with a compass.

Why depth changes what’s possible

There’s a result called the Universal Approximation Theorem worth knowing: a feedforward network with even a single hidden layer, given enough neurons, can approximate any continuous function to any desired accuracy. Not some functions. Any of them. That’s not an incremental step up from linear regression — it’s a different category of tool, which is the argument this whole series is built on.

There’s a catch worth naming honestly, though. A fully connected feedforward network treats every input as independent and unordered. Feed it a photograph as a flat list of pixel values, and it has no innate sense that neighbouring pixels are related. Feed it a sentence word by word, and it has no sense that word order carries meaning. It can technically learn these relationships given enough data, but it’s fighting its own architecture to do so — like teaching someone geography from an alphabetically sorted list of place names. That gap is exactly the seam the next two parts of this series stitch into: convolutional networks give a network something like an eye, recurrent networks and LSTMs give it something like a memory.

Back to the factory floor

Diagram of a neural network model illustrating the input layer with temperature, pressure, accelerometer, and microphone, a hidden layer, and an output layer with a warning symbol.

Which brings us back to where we started. Before any of this works, the temperature and vibration readings need normalising onto comparable footing — feed the network raw values and the numerically larger temperature readings will dominate the weighted sums regardless of which feature actually matters more. Then comes the real design decision: are you predicting whether the machine fails in the next 24 hours — a classification problem, one output neuron, sigmoid activation, cross-entropy loss — or how many days of useful life remain — a regression problem, one output neuron with no squashing activation, mean squared error as the loss?

And one trap worth knowing before you build anything like this: in a working manufacturing plant, failures are rare, maybe one in a hundred. A classifier trained carelessly on that data can hit 99% accuracy by predicting “no failure” every time — right 99 times out of 100, and wrong about the one thing you built it to catch. It’s why the industry leans on precision and recall instead of accuracy here, and why, for maintenance specifically, missing a real failure usually costs more than a false alarm.

Miss Smith’s two-line solution to her dot puzzle wasn’t a trick. It was the whole idea in miniature: some problems need more than one boundary before the answer comes into view. Neural networks scaled that idea up from two lines to millions of weighted connections — enough to learn, from nothing but historical sensor readings, when a machine is about to fail. The next two posts are about what happens when you shape those connections to match the problem in front of you, starting with images.


Machine Learning Evolved: Neo-ML

A schematic diagram of a multi-layer perceptron neural network, featuring an input layer with various attributes like age, income, and political affiliation, two hidden layers with 16 nodes each, and dropout layers, all set against a blueprint-style background.

My secondary school maths teacher, Miss Smith couldn’t be messed with. She wasn’t a big woman, and she didn’t raise her voice, but she had a way that the other teachers lacked — a quiet certainty that made you sit up straighter without quite knowing why. To me, maths was never really about numbers. It was puzzles. Logical puzzles, written in a language of numbers, functions and variables, waiting to be solved. Get the language right, and the answer had to follow. There was no arguing with it, no opinion to have. It simply was. It was then I formed the idea everything can be described in numbers. The “code” of the universe. The basis of AI.

That same love of numbers and logic — the idea that a well-posed problem contains its own answer, if you can only speak its language — is the thread that runs from those classroom puzzles all the way to the earliest machine learning algorithms, some of which trace their roots back centuries. Linear regression. Bayes’ theorem. Decision trees. K-Nearest Neighbour. And more besides. These aren’t relics. They sit quietly inside a huge proportion of the Python solutions doing real work in the world today, and they still deserve their place at the table. If you want to predict next quarter’s revenue from ten years of clean, structured data, you very rarely need anything more exotic than a well-fitted regression. Boring AI wins every time.

But somewhere in the twentieth century, ambition outgrew the puzzle-solver. Statistical models are, at their core, an exercise in description — here is the shape of the data, here is the line that best fits it, here is the probability given what we’ve already observed. What researchers wanted next was something different in kind, not just in degree: a machine that didn’t just describe patterns in data, but learned the way a brain does. Not a better equation. A different kind of thing entirely.

In this series I want to explore what I’m calling Neo-ML — neo machine learning — and how it has evolved to give us deep learning, computer vision, generative AI, and the ability to talk to our data and have it talk back in natural language. We’ll move from the artificial neuron through feedforward networks, into convolutional networks and computer vision, on to recurrent networks and long short-term memory, and finish at autoencoders and the doorway to generative AI. I’ve just coined a new term — Neo-ML — and by the end of this series you’ll understand exactly why it deserves one.

Let’s start this series with the round dot you see in most deep learning diagrams – the node, or neuron. And it’s just a mathematical equation in software. A function.


Part 1: The Artificial Neuron (Node)

The Biological Inspiration

The story starts, as so many things in computing do, with a question that sounds almost philosophical: can we build a machine that thinks?

In 1943, a neurologist named Warren McCulloch and a mathematician named Walter Pitts sat down and asked a more tractable version of that question. They weren’t trying to replicate consciousness. They were trying to model the simplest possible unit of biological computation — the neuron — in mathematical terms. Their paper, A Logical Calculus of the Ideas Immanent in Nervous Activity, described a neuron as something that receives signals, adds them up, and fires if the total crosses a threshold. Binary. On or off. Yes or no.

It was a brutal simplification of what a real neuron does. But it was the right simplification. It captured the essential logic: inputs come in, something happens in the middle, and a decision comes out.

That structure — inputs, transformation, output — is the skeleton of every artificial neuron ever built. Everything else in this series is an elaboration of it.

What an Artificial Neuron Actually Does

Let’s make it concrete.

Imagine you’re trying to decide whether to take an umbrella when you leave the house. You look at a few things: the sky looks grey, the forecast says 70% chance of rain, and you remember it rained yesterday. Each of those is an input. But they don’t all carry the same weight. The forecast matters more than the colour of the sky. Your memory of yesterday matters least of all.

An artificial neuron works the same way. It takes a set of inputs — numbers, each representing some feature of the world — and multiplies each one by a weight. The weight is the neuron’s way of saying how much it cares about that particular input. It then adds all those weighted inputs together, throws in a small constant called a bias, which lets it shift its behaviour even when all inputs are zero, and passes the result through a function that decides what to output.

In plain terms: the output equals an activation function applied to the weighted sum of the inputs, plus a bias. That last piece — the activation function — is where things get interesting.

The Activation Function: Where Non-Linearity Lives

Diagram of an artificial neuron depicting input values (x1, x2, x3), weights (w1, w2, w3), summation (Σ), activation function (f), and the output (y) with annotations referencing 1940s research.

If you removed the activation function and just kept the weighted sum, you’d have a linear model. Useful, but limited. The whole point of neural networks is that the real world is not linear. The relationship between the pixels in a photograph and the word “cat” is not a straight line. Neither is the relationship between a sentence and its sentiment, or between a patient’s symptoms and their diagnosis.

The activation function introduces non-linearity. It takes the raw weighted sum and squashes it, bends it, or clips it into a shape that lets the network learn curved, complex relationships.

The earliest activation function was the step function — exactly what McCulloch and Pitts described. If the sum crosses the threshold, output 1. Otherwise, output 0. Clean, but not differentiable, which matters enormously when you want to train the network (more on that in the next post).

The sigmoid function came next. It takes any input and maps it smoothly to a value between 0 and 1, producing an S-shaped curve. For a long time, it was the default choice. It has problems at the extremes — the gradients become vanishingly small, which makes learning slow — but it was a significant step forward.

Close behind sigmoid came the hyperbolic tangent, or tanh. It solves a similar problem in a similar shape — another smooth S-curve — but where sigmoid squashes everything into a range between 0 and 1, tanh maps to a range between -1 and 1. That zero-centring matters more than it sounds like it should: because tanh’s outputs can be negative, the weights in the next layer get pushed both up and down during training rather than only ever nudged in one direction. In practice, that tends to make networks converge faster than sigmoid does. It doesn’t solve the vanishing gradient problem — the curve still flattens out at the extremes, just like sigmoid’s does — but for a long stretch of the field’s history, tanh was the safer default of the two.

Today, the most widely used activation function is something almost embarrassingly simple: the Rectified Linear Unit, or ReLU. If the input is negative, output zero. If it’s positive, output the input unchanged. That’s it. No smooth curve, no elegant formula. Just a hinge. And yet ReLU, and its variants, power the majority of modern deep learning systems. Sometimes the right answer really is the simple one.

Why This Is a Different Kind of Thing

Here is the point that the name Neo-ML is trying to capture.

Classical machine learning algorithms — regression, decision trees, support vector machines — are built around explicit mathematical relationships. You, the engineer, decide what features matter. You decide how they relate to the output. The algorithm finds the best parameters to fit those relationships to the data. The structure of the model is yours. The algorithm fills in the numbers.

An artificial neuron — and the networks built from them — works differently. You don’t specify the relationships. You specify the architecture: how many neurons, how they’re connected, what activation functions they use. Then you show the network data, and it learns the relationships itself. The weights and biases are not chosen by you. They are discovered, through a process of trial and error at a scale no human could manage, by the training algorithm.

This is not a quantitative difference. It is a qualitative one. The model is not a description of the world that you wrote. It is a description of the world that the machine wrote, in a language of numbers that no human fully reads.

That shift — from models we design to models that design themselves — is what makes neural networks a different kind of thing. Not smarter than classical ML in every situation. Not always the right tool. But categorically different in what they are and how they work.

The Perceptron: The First Learnable Neuron

McCulloch and Pitts gave us the structure. But their neuron couldn’t learn. The weights were set by hand. It took another fifteen years, and a psychologist named Frank Rosenblatt, to build the first neuron that could update its own weights based on experience.

In 1958, Rosenblatt introduced the Perceptron. The idea was simple: show the neuron a labelled example, let it make a prediction, compare the prediction to the correct answer, and nudge the weights in the direction that would have made the prediction better. Do this thousands of times, across thousands of examples, and the weights gradually converge on something useful.

The Perceptron learning rule is the ancestor of every training algorithm in modern deep learning. Backpropagation, gradient descent, Adam optimisers — all of them are elaborations of the same core idea: measure the error, and adjust the weights to reduce it.

Rosenblatt was famously optimistic about what the Perceptron could do. Too optimistic, as it turned out. In 1969, Marvin Minsky and Seymour Papert published Perceptrons, a rigorous mathematical analysis that showed a single-layer Perceptron could not solve problems that weren’t linearly separable. The classic example is XOR — a logical operation so simple a child can understand it, but one that a single Perceptron cannot learn. The field went quiet for a decade. The first AI winter had arrived.

The solution, when it came, was obvious in retrospect: stack the neurons. Put one layer’s outputs into the next layer’s inputs. Build depth. That is the feedforward neural network, and it is where we go next.

What We’ve Established

A single artificial neuron is a small, precise thing. It takes inputs, weights them, sums them, applies a non-linear function, and produces an output. It can learn — in the sense that its weights can be adjusted to improve its predictions. And it is, in a meaningful sense, a different kind of computational object from the statistical models that came before it.

One neuron, on its own, is not very impressive. It can draw a line through data. It can make a binary decision. It is, in the end, not so different from logistic regression.

But connect enough of them together, in the right way, and something remarkable happens. The network stops drawing lines and starts drawing boundaries of arbitrary complexity. It stops recognising simple patterns and starts recognising faces, voices, sentences, intentions.

That emergence — the way complexity arises from simplicity, the way the whole becomes vastly more than the sum of its parts — is what the rest of this series is about.

Miss Smith would have approved. It turns out the universe is still a puzzle. We’ve just found a new way to speak its language.


Next up: Feed forward Networks