MachineIntelligenceCore:NeuralNets
|
Class implementing a simple MNIST patch softmax classification with multi-layer neural net - imported from previously loaded auto-encoder net and adds softmax layer "at the top". More...
#include <MNISTPatchSoftmaxApplication.hpp>
Public Member Functions | |
MNISTPatchSoftmaxApplication (std::string node_name_="mnist_patch_autoencoder_reconstruction") | |
virtual | ~MNISTPatchSoftmaxApplication () |
Protected Member Functions | |
virtual void | initializePropertyDependentVariables () |
virtual void | initialize (int argc, char *argv[]) |
virtual bool | performLearningStep () |
virtual void | collectTestStatistics () |
virtual void | populateTestStatistics () |
Private Attributes | |
mic::importers::MNISTPatchImporter * | training_dataset_importer |
Importer responsible for loading training dataset. More... | |
mic::importers::MNISTPatchImporter * | test_dataset_importer |
Importer responsible for loading testing dataset. More... | |
mic::encoders::MatrixXfMatrixXfEncoder * | mnist_encoder |
MNIST matrix encoder. More... | |
mic::encoders::UIntMatrixXfEncoder * | label_encoder |
Label 2 matrix encoder (1 hot). More... | |
WindowMatrix2D * | w2d_input |
Window for displaying the input image. More... | |
WindowCollectorChart< float > * | w_chart |
Window for displaying chart with statistics. More... | |
WindowProbability * | w_prob |
Window displaying the probabilities. More... | |
mic::types::MatrixXfPtr | input_image |
Input image/matrix. More... | |
mic::types::MatrixXfPtr | decoded_prediction |
Probability. More... | |
mic::types::MatrixXfPtr | input_target |
Probability. More... | |
size_t | patch_size |
Size of the patch - copied from importers. More... | |
mic::utils::DataCollectorPtr < std::string, float > | collector_ptr |
Data collector. More... | |
mic::configuration::Property < std::string > | autoencoder_filename |
Property: name of the file to which the original auto-encoder will be loaded from. More... | |
mic::configuration::Property < size_t > | autoencoder_layers_to_be_removed |
Property: number of layers to be removed (starting from the last one). More... | |
mic::configuration::Property < std::string > | softmax_filename |
Property: name of the file with softmax nn. More... | |
mic::configuration::Property < bool > | softmax_save |
Property: flag denoting whether the nn should be saved to a file (after every episode end). More... | |
mic::configuration::Property < bool > | softmax_load |
Property: flag denoting whether the nn should be loaded from a file (at the initialization of the task) - if not, the program will try to import and reshape the autoencoder. More... | |
BackpropagationNeuralNetwork < float > | neural_net |
Multi-layer neural network. More... | |
Class implementing a simple MNIST patch softmax classification with multi-layer neural net - imported from previously loaded auto-encoder net and adds softmax layer "at the top".
Definition at line 52 of file MNISTPatchSoftmaxApplication.hpp.
mic::applications::MNISTPatchSoftmaxApplication::MNISTPatchSoftmaxApplication | ( | std::string | node_name_ = "mnist_patch_autoencoder_reconstruction" | ) |
Default Constructor. Sets the application/node name, default values of variables, initializes classifier etc.
node_name_ | Name of the application/node (in configuration file). |
Definition at line 58 of file MNISTPatchSoftmaxApplication.cpp.
References autoencoder_filename, autoencoder_layers_to_be_removed, softmax_filename, softmax_load, softmax_save, test_dataset_importer, and training_dataset_importer.
|
virtual |
Destructor.
Definition at line 79 of file MNISTPatchSoftmaxApplication.cpp.
References label_encoder, mnist_encoder, test_dataset_importer, training_dataset_importer, w2d_input, w_chart, and w_prob.
|
protectedvirtual |
Collects test statistics, executed in every testing step.
Definition at line 191 of file MNISTPatchSoftmaxApplication.cpp.
References collector_ptr, label_encoder, mnist_encoder, neural_net, mic::mlnn::BackpropagationNeuralNetwork< eT >::test(), and test_dataset_importer.
|
protectedvirtual |
Method initializes GLUT and OpenGL windows.
argc | Number of application parameters. |
argv | Array of application parameters. |
Definition at line 91 of file MNISTPatchSoftmaxApplication.cpp.
References collector_ptr, w2d_input, w_chart, and w_prob.
|
protectedvirtual |
Initializes all variables that are property-dependent, imports MNIST datasets, for both learning and testing purposes.
Definition at line 112 of file MNISTPatchSoftmaxApplication.cpp.
References autoencoder_filename, autoencoder_layers_to_be_removed, decoded_prediction, input_image, input_target, label_encoder, mic::mlnn::MultiLayerNeuralNetwork< eT >::load(), mnist_encoder, neural_net, patch_size, mic::mlnn::MultiLayerNeuralNetwork< eT >::popLayer(), mic::mlnn::MultiLayerNeuralNetwork< eT >::pushLayer(), mic::mlnn::BackpropagationNeuralNetwork< eT >::setLoss(), softmax_filename, softmax_load, test_dataset_importer, training_dataset_importer, w2d_input, and w_prob.
|
protectedvirtual |
Performs learning step.
Definition at line 164 of file MNISTPatchSoftmaxApplication.cpp.
References collector_ptr, mic::mlnn::MultiLayerNeuralNetwork< eT >::getPredictions(), label_encoder, mnist_encoder, neural_net, mic::mlnn::BackpropagationNeuralNetwork< eT >::train(), and training_dataset_importer.
|
protectedvirtual |
Populates test statistics, executed only every number_of_averaged_test_measures testing steps.
Definition at line 210 of file MNISTPatchSoftmaxApplication.cpp.
References neural_net, mic::mlnn::MultiLayerNeuralNetwork< eT >::save(), softmax_filename, and softmax_save.
|
private |
Property: name of the file to which the original auto-encoder will be loaded from.
Definition at line 132 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initializePropertyDependentVariables(), and MNISTPatchSoftmaxApplication().
|
private |
Property: number of layers to be removed (starting from the last one).
Definition at line 135 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initializePropertyDependentVariables(), and MNISTPatchSoftmaxApplication().
|
private |
Data collector.
Definition at line 129 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by collectTestStatistics(), initialize(), and performLearningStep().
|
private |
Probability.
Definition at line 120 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initializePropertyDependentVariables().
|
private |
Input image/matrix.
Definition at line 117 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initializePropertyDependentVariables().
|
private |
Probability.
Definition at line 123 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initializePropertyDependentVariables().
|
private |
Label 2 matrix encoder (1 hot).
Definition at line 105 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by collectTestStatistics(), initializePropertyDependentVariables(), performLearningStep(), and ~MNISTPatchSoftmaxApplication().
|
private |
MNIST matrix encoder.
Definition at line 102 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by collectTestStatistics(), initializePropertyDependentVariables(), performLearningStep(), and ~MNISTPatchSoftmaxApplication().
|
private |
Multi-layer neural network.
Definition at line 147 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by collectTestStatistics(), initializePropertyDependentVariables(), performLearningStep(), and populateTestStatistics().
|
private |
Size of the patch - copied from importers.
Definition at line 126 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initializePropertyDependentVariables().
|
private |
Property: name of the file with softmax nn.
Definition at line 138 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initializePropertyDependentVariables(), MNISTPatchSoftmaxApplication(), and populateTestStatistics().
|
private |
Property: flag denoting whether the nn should be loaded from a file (at the initialization of the task) - if not, the program will try to import and reshape the autoencoder.
Definition at line 144 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initializePropertyDependentVariables(), and MNISTPatchSoftmaxApplication().
|
private |
Property: flag denoting whether the nn should be saved to a file (after every episode end).
Definition at line 141 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by MNISTPatchSoftmaxApplication(), and populateTestStatistics().
|
private |
Importer responsible for loading testing dataset.
Definition at line 99 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by collectTestStatistics(), initializePropertyDependentVariables(), MNISTPatchSoftmaxApplication(), and ~MNISTPatchSoftmaxApplication().
|
private |
Importer responsible for loading training dataset.
Definition at line 96 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initializePropertyDependentVariables(), MNISTPatchSoftmaxApplication(), performLearningStep(), and ~MNISTPatchSoftmaxApplication().
|
private |
Window for displaying the input image.
Definition at line 108 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initialize(), initializePropertyDependentVariables(), and ~MNISTPatchSoftmaxApplication().
|
private |
Window for displaying chart with statistics.
Definition at line 111 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initialize(), and ~MNISTPatchSoftmaxApplication().
|
private |
Window displaying the probabilities.
Definition at line 114 of file MNISTPatchSoftmaxApplication.hpp.
Referenced by initialize(), initializePropertyDependentVariables(), and ~MNISTPatchSoftmaxApplication().