Neural Networks from Scratch in Python Book

neural networks from scratch

“Neural Networks From Scratch” is a book intended to teach you how to build neural networks on your own, without any libraries, so you can better understand deep learning and how all of the elements work. This is so you can go out and do new/novel things with deep learning as well as to become more successful with even more basic models.

This book is to accompany the usual free tutorial videos and sample code from youtube.com/sentdex. This topic is one that warrants multiple mediums and sittings. Having something like a hard copy that you can make notes in, or access without your computer/offline is extremely helpful. All of this plus the ability for backers to highlight and post comments directly in the text should make learning the subject matter even easier.

Physical books are “print on demand” from printers around the world. Delivery times will vary hugely based on local and global factors, but, in general, expect delivery in 3-6 weeks.

neural networks from scratch
neural networks from scratch
neural networks from scratch

The Neural Networks from Scratch book is printed in full color for both images and charts as well as for Python syntax highlighting for code and references to code in the text.

neural networks from scratch
neural networks from scratch
neural networks from scratch

The physical version of Neural Networks from Scratch is available as softcover or hardcover:

neural networks from scratch

First off, there’s none of that “intro to programming” padding of any kind! The book starts off with a brief outline of what neural networks are and some general background on the structure of machine learning algorithms, as I expect some people will have neural networks as their first machine learning algorithm and be a bit confused about terms like “features” and “labels” …etc.

Within short order, we’re coding our first neurons, creating layers of neurons, building activation functions, calculating loss, and doing backpropagation with various optimizers. Everything is covered to code, train, and use a neural network from scratch in Python.

Everything we do is shown first in pure, raw, Python (no 3rd party libraries). Then you’re shown how to use NumPy (the go-to 3rd party library in Python for doing mathematics) to do the same thing, since learning more about using NumPy can be a great side-benefit of the book.

In this book, you will:

  • – Code a neuron
  • – Learn how to connect these neurons in layers
  • – Program activation functions: Rectified Linear (ReLU), Softmax, Sigmoid, and Linear
  • – Calculate cross-entropy loss
  • – Code and perform gradient computations using backpropagation and parameter updates using optimizers: Stochastic Gradient Descent (SGD), AdaGrad, RMSprop, and Adam
  • – …and most importantly: build and train a fully working neural network, from scratch, in Python…learning a ton along the way!

Certain concepts, while also explained by text and images, can also be supplemented with animations. In the book, there will be QR codes to help explain certain concepts, for example (you need a QR-scanning app on your phone, and feel free to give this one a go):

neural networks from scratch
neural networks from scratch
neural networks from scratch

When it comes to tutorials with deep learning, the job of the educator is to simplify, in order to make things easiest to digest. With deep learning, this means importing a library with an easy-to-use API like TensorFlow/Keras or Pytorch.

It means solving an already-solved problem. It means using a simple dataset. It means using a pre-planned network that is known to work for that data.

…and it means you will probably fall flat on your face when you try to solve something someone hasn’t yet already solved for you.

For basic classification tasks like cats vs dogs, a very rudimentary knowledge of neural networks can get you where you want to be most of the time, but you will almost certainly find yourself blindly changing things with no real purpose as you hunt for something that works or works better than what you currently have.

If you want to really know what happens with data as it comes into your neurons, what your hidden layer activation functions are doing, what your output layer activation functions are doing, how loss is calculated, how optimizers fit in, and, most importantly, how to build models that do new or novel things, then you will need a deeper understanding like what this book offers.

neural networks from scratch

A purchase of any version of the book also comes with ebook access.

The ebook is delivered in two forms. After purchase, you should receive the PDF version within minutes to your email. We also have a Google Documents version, which allows you to highlight and comment within the book in order to ask questions that we (the authors) and anyone else can see and help with. Access to the Google Doc can take up to 48 hours.

If there’s a point where you’re lost/confused, you can highlight the area and post a comment at the precise location to the public document, like shown in the video below:

Your browser does not support the video tag.

This is great for you because you can get direct help and support through an otherwise difficult subject matter, and it’s great for us because it will help us to improve the book over time, by showing us where the common pain-points and confusions are in the book.

If you truly want to make sure you learn this material and don’t get lost, I cannot imagine a better way to do it.

neural networks from scratch

You are expected to know only the basics of Python and object oriented programming, both of which you can learn here for free.

You are not expected to know anything about neural networks or the math that goes into them.

You should have a high-school-level knowledge of math in general up to linear algebra. The book explains everything beyond this. If you want to brush up on your math, there’s always Khan Academy. I didn’t do well in math in school, and I didn’t take any math courses in college, but I learned all of these things for free online, and you can too!

Contact

If you are wondering where your draft access is, or you have any questions, please feel free to email [email protected]

You may also receive emails from [email protected], which we’re currently using to automatically handle for some issues in order shipping. If you’re wondering where your book is, contact [email protected] and check your spam folders for anything from [email protected].

Refund/return policy:

Due to the nature of how these books are distributed (literally shipped from printers around the world) and the electronic access (draft/ebook) being a scenario where you could buy, download, then request a refund, I will be going through returns/refunds on a case-by-case basis. For the physical books, they are “print on demand,” which means the printing process begins nearly immediately upon your order at a printer closest to you physically.

You should be buying the books under the impression of a NO REFUNDS/ALL SALES ARE FINAL stipulation, especially when purchasing the ebook only. If you receive a damaged book, or are having trouble accessing the ebook, please contact me.

Our top priority is that everyone who supports this project gets exactly what they expected. If you are unhappy in any way, please start by contacting [email protected].

If you have questions/concerns about things like the contents of the book…etc, feel free to contact me before purchasing.