Build the Neural Network Class
Define a basic skeleton code of neural network class.
We'll cover the following
Introduction
Now we’ll start to make our own neural network with Python. We’ll take small, easy steps to build a Python program bit by bit.
Starting small and going slowly is a wise approach to building computer code of even moderate complexity.
Let’s start building the skeleton of a neural network class.
The skeleton code
Let’s decide what a neural network class should look like. We know it should have at least three functions:
-
initialization
: We’ll use this to set the number of input, hidden, and output nodes. -
train
: We’ll use this to refine the weights after being given a training set example to learn from. -
query
: We’ll use this to give an answer from the output nodes after an input is given.
These might not be perfectly defined right now, and we might need more functions later, but let’s use these to start.
The code will look something like this:
Get hands-on with 1400+ tech skills courses.