Cover of Make Your Own Neural Network by Tariq Rashid, featuring abstract representations of connected nodes and signal flow

Published

2016

AI Learning ✨ New

Make Your Own Neural Network

A step-by-step guide to building neural networks from scratch in Python

Build a working neural network in Python from the ground up, and understand exactly why every line of code does what it does.

Make Your Own Neural Network strips away the mysticism around AI and machine learning by guiding you through the mathematics and code behind a real, working neural network. Starting with basic Python and simple maths, Tariq Rashid builds up the theory incrementally, so you finish the book having written a neural network that can recognise handwritten digits β€” and, more importantly, knowing why it works.

About this book

Neural networks are behind voice assistants, image recognition, and language models. Most introductory resources either gloss over the maths or assume you already hold a graduate degree in statistics. This book takes neither shortcut.

Tariq Rashid starts from first principles. You learn what a neural network actually is β€” a series of weighted connections tuned by repeated error correction β€” before a single line of code is written. The maths (gradients, matrix multiplication, backpropagation) arrives piece by piece, explained in plain language with worked examples, not thrown at you as prerequisites.

By the time you reach the final project, you will have built a neural network in Python that reads the classic MNIST handwritten digit dataset and classifies images with accuracy that would have seemed remarkable a decade ago. You typed every line. You understand every step. No black-box library hides what is really happening.

The book is deliberately short and focused. There are no detours into unrelated algorithms or framework comparisons. The goal is one thing done well: a reader who picked up the book with curiosity and basic Python walks away with a working neural network and a solid mental model of how deep learning actually learns.

  • Gradual mathematical build-up: fractions, algebra, and then calculus β€” each introduced only when it is needed
  • Clean Python code that fits on a single screen, with no external AI frameworks
  • The full MNIST digit-recognition project, built incrementally across multiple chapters
  • Intuition-first explanations of backpropagation and gradient descent
  • A final chapter showing how to run the network on a Raspberry Pi

If you have ever wanted to understand neural networks beyond a surface-level description, this is where to start.

🎯 What you'll learn

  • Explain how a neural network learns by adjusting weights through repeated error feedback
  • Apply the chain rule and gradient descent without needing a calculus textbook
  • Implement forward and backward passes in plain Python using only NumPy
  • Train a multi-layer network on real image data and measure its accuracy
  • Diagnose why a network is failing to learn and adjust hyperparameters to fix it
  • Run a trained neural network on a Raspberry Pi with no changes to the core code
  • Build an intuition for matrix operations that transfers directly to framework-based work later

πŸ‘€ Who is this book for?

  • Beginners with basic Python knowledge who want to understand how neural networks actually work, not just use them
  • Self-taught developers curious about machine learning who have bounced off courses that assume too much maths up front
  • Students who have read high-level AI explainers and now want to see the real mechanics
  • Hobbyists and Raspberry Pi tinkerers who want a practical, completable project in the AI space
  • Professionals from non-CS backgrounds who need a solid foundation before moving to advanced frameworks

Table of contents

  1. 01

    How the Brain Inspires Neural Networks

    Introduces the biological metaphor behind artificial neurons and explains why the brain-inspired model is so powerful for pattern recognition. You build a clear mental picture of what a neural network is before any code appears.

  2. 02

    A Simple Classifier

    Walks through the mathematics of a single-layer classifier, covering weighted sums and the idea of a threshold. You implement a minimal working example to see the core mechanics in isolation.

  3. 03

    Working with Signals

    Introduces activation functions and explains why a non-linear step is essential. You explore how the sigmoid function shapes outputs and why it makes learning possible.

  4. 04

    Learning β€” Training a Network

    Covers the error-correction loop at the heart of supervised learning, introducing gradient descent and backpropagation step by step. By the end you have a network that adjusts its own weights after each example.

  5. 05

    Matrix Multiplication for Neural Networks

    Reframes the forward and backward passes as matrix operations, showing why NumPy makes this practical. You refactor your earlier code into a clean, matrix-based implementation.

  6. 06

    Building a Three-Layer Network

    Extends the two-layer model to a full input-hidden-output architecture. You implement and test the complete network structure that will carry through to the final project.

  7. 07

    Recognising Handwritten Digits

    Applies your network to the MNIST dataset and walks through loading, normalising, and feeding real image data. You measure classification accuracy and tune learning rate and epoch count to improve results.

  8. 08

    Neural Networks on a Raspberry Pi

    Shows how to export your trained network and run it on a Raspberry Pi, demonstrating that the code you wrote is genuinely self-contained. You classify live handwritten input on low-cost hardware.

Frequently asked questions

What Python knowledge do I need before reading this book?

You need to be comfortable with basic Python syntax: variables, loops, functions, and importing libraries. No prior experience with machine learning, NumPy, or mathematics beyond secondary-school level is assumed.

Does the book use TensorFlow, PyTorch, or any other AI framework?

No. The network is built using only Python and NumPy so that every operation is visible and understandable. The point is to learn what frameworks do under the hood, not to learn a specific framework.

Is this book still relevant given how much AI has changed since 2016?

The fundamentals of feedforward neural networks and backpropagation have not changed. This book teaches those foundations, which remain the prerequisite for understanding modern deep learning frameworks and architectures.

What is the main project in the book?

You build a neural network that classifies handwritten digits from the MNIST dataset. The project runs end-to-end in plain Python and achieves accuracy in the high nineties percent range with a tuned configuration.

Is this book suitable for complete beginners to programming?

It is aimed at people who have at least a little programming experience. Absolute beginners may find the pace comfortable, but having written a Python script or two before will help you focus on the neural network concepts rather than the syntax.

Does the book cover convolutional or recurrent networks?

No. The book focuses entirely on fully connected feedforward networks. That focus is intentional β€” mastering this architecture gives you the foundation to move on to CNNs and RNNs with confidence.

You might also like

πŸ“¬ Weekly Newsletter

Stay ahead of the curve

Get the best programming tutorials, data analytics tips, and tool reviews delivered to your inbox every week.

No spam. Unsubscribe anytime.