Commit 02b844ea authored by Davis King's avatar Davis King

Fixed grammar and clarified a few things.

parent d6c60309
...@@ -39,8 +39,8 @@ int main(int argc, char** argv) try ...@@ -39,8 +39,8 @@ int main(int argc, char** argv) try
// MNIST is broken into two parts, a training set of 60000 images and a test set of // MNIST is broken into two parts, a training set of 60000 images and a test set of
// 10000 images. Each image is labeled so we know what hand written digit is depicted. // 10000 images. Each image is labeled so that we know what hand written digit is
// These next statements load the dataset into memory. // depicted. These next statements load the dataset into memory.
std::vector<matrix<unsigned char>> training_images; std::vector<matrix<unsigned char>> training_images;
std::vector<unsigned long> training_labels; std::vector<unsigned long> training_labels;
std::vector<matrix<unsigned char>> testing_images; std::vector<matrix<unsigned char>> testing_images;
...@@ -64,8 +64,8 @@ int main(int argc, char** argv) try ...@@ -64,8 +64,8 @@ int main(int argc, char** argv) try
// Finally, the loss layer defines the relationship between the network outputs, our 10 // Finally, the loss layer defines the relationship between the network outputs, our 10
// numbers, and the labels in our dataset. Since we selected loss_multiclass_log it // numbers, and the labels in our dataset. Since we selected loss_multiclass_log it
// means we want to do multiclass classification with our network. Moreover, the // means we want to do multiclass classification with our network. Moreover, the
// number of network outputs (i.e. 10) is the number of possible labels and whichever // number of network outputs (i.e. 10) is the number of possible labels. Whichever
// network output is biggest is the predicted label. So for example, if the first // network output is largest is the predicted label. So for example, if the first
// network output is largest then the predicted digit is 0, if the last network output // network output is largest then the predicted digit is 0, if the last network output
// is largest then the predicted digit is 9. // is largest then the predicted digit is 9.
using net_type = loss_multiclass_log< using net_type = loss_multiclass_log<
...@@ -99,18 +99,18 @@ int main(int argc, char** argv) try ...@@ -99,18 +99,18 @@ int main(int argc, char** argv) try
trainer.set_synchronization_file("mnist_sync", std::chrono::seconds(20)); trainer.set_synchronization_file("mnist_sync", std::chrono::seconds(20));
// Finally, this line begins training. By default, it runs SGD with our specified step // Finally, this line begins training. By default, it runs SGD with our specified step
// size until the loss stops decreasing. Then it reduces the step size by a factor of // size until the loss stops decreasing. Then it reduces the step size by a factor of
// 10 and continues running until loss stops decreasing again. It will reduce the step // 10 and continues running until the loss stops decreasing again. It will reduce the
// size 3 times and then terminate. For a longer discussion see the documentation for // step size 3 times and then terminate. For a longer discussion, see the documentation
// the dnn_trainer object. // of the dnn_trainer object.
trainer.train(training_images, training_labels); trainer.train(training_images, training_labels);
// At this point our net object should have learned how to classify MNIST images. But // At this point our net object should have learned how to classify MNIST images. But
// before we try it out let's save it to disk. Note that, since the trainer has been // before we try it out let's save it to disk. Note that, since the trainer has been
// running images through the network, net will have a bunch of state in it related to // running images through the network, net will have a bunch of state in it related to
// the last image it processed (e.g. outputs from each layer). Since we don't care // the last batch of images it processed (e.g. outputs from each layer). Since we
// about saving that kind of stuff to disk we can tell the network to forget about that // don't care about saving that kind of stuff to disk we can tell the network to forget
// kind of transient data so that our file will be smaller. We do this by "cleaning" // about that kind of transient data so that our file will be smaller. We do this by
// the network before saving it. // "cleaning" the network before saving it.
net.clean(); net.clean();
serialize("mnist_network.dat") << net; serialize("mnist_network.dat") << net;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment