 Now, we get to a meaty bit. This is the script that trains the model. It builds the model structure up and then runs it through the training iterations. We start by going to our Cottonwood framework and pulling in all the basic building blocks we'll need. The logistic and the hyperbolic tangent activation functions. Our 2D convolution block. Our training data, from our MNIST data block, the linear block, a hinge loss, a bias block, the copy, flatten, hardmax, and one-hot blocks from the operations package, our stochastic gradient descent, our pooling, and then the structure. We also have a value logger in there, which is just a utility that pulls out a value, in this case our loss, and tracks it over time. Structure is the Cottonwood name for the model, the graph, the directed acyclic graph that we're going to be building. It's the collection of blocks or collection of layers that will be the neural network. That's the name for this data structure, for this class. All of the parameters that we will be likely to tweak and adjust when making changes, I like to put right up at the beginning. So the learning rate, the size of the kernels, the parameters controlling the size of the L1 and L2 regularization, the total number of classes, this is defined by our data set, that's not going to change, the total number of kernels in each of our convolution layers, and the total number of training iterations, and then how often the model saves out a copy of itself during training. I've come to really enjoy this best so far model, saving it out periodically so that if at any time, if you're three days into training a model and your power goes out and your training run crashes, you don't lose all that time, you always have a recent version of the model saved and you can pick up from there. It also lets you, while that model is running and training in the background, you can evaluate the results at any point along the way and use them to do something else, but you don't have to interrupt training and you can set up and run in the background a training run to run for days or even weeks if you have a model that you're very passionate about or really want to train well. Then we have the location for where we're going to save that model and then we start pulling in and creating our blocks. So we use our training data class, we instantiate it to get our training data block, we use our stochastic gradient descent class, and we initialize, create an instance with our learning rate to get an optimizer block. Then we initialize our structure, this is our model, our classifier. Creating a model in Cottonwood has two steps. The first thing we do is we add in all of the blocks, all of the pieces that we're going to want to use and then we connect them up. This lets us, in theory, create graphs of arbitrary topology. We'll dig into this more later, but Cottonwood works with directed acyclic graphs that also are reversible. So they have a forward pass and then you can run a backward pass.