Exercise 4. Build an ANN stub.
A neural network framework is a sprawling complex of functions and objects. It can feel unapproachable when you sit down to write it in code. We're going to try to avoid this by sticking to a top-down coding approach. First we'll pretend that the framework is already written, call the functionality we want, and assume the results are good. Then we'll fill in the mechanisms underneath, layer by layer, until we've reach the bottom and are no longer inventing new functions, but are writing in straightforward python. It's like building a skyscraper starting at the top floor and filling the floors underneath, one-by-one, until you reach the ground.
Another way to think about it is like a giant pan of brownies. First we'll define the outside edges of the pan. (This is constructing a simple test case, as in Exercises 1-3, and calling on the framework to create and train a neural network.) Then we slice the pan down the middle. (This is writing function stubs for all the top-level functions, calling on progressively lower-level functionality in the framework.) We repeat this process, cutting and subdividing, until all we're left with is tiny, bite-sized brownie pieces. (This is when we get to native python and numpy functions.)
- Create a package called nn_framework. That's just a directory, with an empty __init__.py file in it.
- In that package create a module in it called framework.py
- In that module, create a class called ANN
- Write stubs for train() and evaluate() methods for the class. They don't have to do anything for now.
- In the run_framework.py script, instantiate a new ANN called autoencoder. Run the train() and evaluate() methods on it.