explaingit

mnielsen/neural-networks-and-deep-learning

Analysis updated 2026-06-24

17,651PythonAudience · researcherComplexity · 2/5LicenseSetup · moderate

TLDR

Python code samples from Michael Nielsen's free book Neural Networks and Deep Learning. A from-scratch educational implementation, not a production framework.

Mindmap

mindmap
  root((nndl-code))
    Inputs
      MNIST data
      Hyperparameters
    Outputs
      Trained network
      Accuracy on test set
    Use Cases
      Follow along with the book
      Learn backprop from scratch
      Teaching reference
    Tech Stack
      Python
      NumPy
    Notes
      Python 2 only
      Not actively maintained
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Run the code examples alongside Michael Nielsen's free book

USE CASE 2

Study a clean from-scratch neural net training loop

USE CASE 3

Teach backpropagation using minimal NumPy code

What is it built with?

PythonNumPy

How does it compare?

mnielsen/neural-networks-and-deep-learningagent0ai/agent-zeropytorch/vision
Stars17,65117,65017,675
LanguagePythonPythonPython
Setup difficultymoderatehardmoderate
Complexity2/54/54/5
Audienceresearcherdeveloperresearcher

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Code was written for Python 2.6 or 2.7. Use a community Python 3 fork or expect to patch it.

MIT license. Use freely for any purpose including commercial, keep the copyright notice.

In plain English

This repository contains the Python code samples that accompany the book "Neural Networks and Deep Learning" by Michael Nielsen. The book is a free online resource that explains how neural networks, the foundational technology behind modern AI, actually work, starting from first principles. The code here is meant to be read alongside the book, giving you runnable examples that demonstrate the concepts explained in the text. The code is written in Python and is primarily intended as a companion to the written material rather than a standalone toolkit. The author has stated he does not intend to add new features or update the code for newer versions of Python, it was written for Python 2.6 or 2.7 and is kept as-is for historical consistency with the book. A community fork with Python 3 compatibility exists separately. You would use this repository if you are working through the "Neural Networks and Deep Learning" book and want to run the code examples yourself, or if you want to study a clear, educational implementation of neural network training written without heavy frameworks. The code is released under the MIT license, which means you are free to use, copy, and modify it for any purpose.

Copy-paste prompts

Prompt 1
Port mnielsen's neural-networks-and-deep-learning network.py from Python 2 to modern Python 3
Prompt 2
Walk me through the backprop math in this repo's network.py line by line
Prompt 3
Run the MNIST training example from this repo on a fresh Python 3.11 setup and fix any errors
Prompt 4
Compare this from-scratch network with an equivalent PyTorch implementation for the same MNIST task

Frequently asked questions

What is neural-networks-and-deep-learning?

Python code samples from Michael Nielsen's free book Neural Networks and Deep Learning. A from-scratch educational implementation, not a production framework.

What language is neural-networks-and-deep-learning written in?

Mainly Python. The stack also includes Python, NumPy.

What license does neural-networks-and-deep-learning use?

MIT license. Use freely for any purpose including commercial, keep the copyright notice.

How hard is neural-networks-and-deep-learning to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is neural-networks-and-deep-learning for?

Mainly researcher.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub mnielsen on gitmyhub

Verify against the repo before relying on details.