This is code is from the book The StatQuest Illustrated Guide to Neural Networks and AI by Josh Starmer (me!). You can look at it here, but it's more fun to play with it, which you can do two easy ways: Google colab: Lightning Studio: