MachineIntelligenceCore:NeuralNets
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
mic::applications::MNISTPatchSoftmaxApplication Class Reference

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>

Inheritance diagram for mic::applications::MNISTPatchSoftmaxApplication:
Collaboration diagram for mic::applications::MNISTPatchSoftmaxApplication:

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...
 

Detailed Description

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".

Author
tkornuta

Definition at line 52 of file MNISTPatchSoftmaxApplication.hpp.

Constructor & Destructor Documentation

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.

Parameters
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.

mic::applications::MNISTPatchSoftmaxApplication::~MNISTPatchSoftmaxApplication ( )
virtual

Member Function Documentation

void mic::applications::MNISTPatchSoftmaxApplication::collectTestStatistics ( )
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.

Here is the call graph for this function:

void mic::applications::MNISTPatchSoftmaxApplication::initialize ( int  argc,
char *  argv[] 
)
protectedvirtual

Method initializes GLUT and OpenGL windows.

Parameters
argcNumber of application parameters.
argvArray of application parameters.

Definition at line 91 of file MNISTPatchSoftmaxApplication.cpp.

References collector_ptr, w2d_input, w_chart, and w_prob.

void mic::applications::MNISTPatchSoftmaxApplication::initializePropertyDependentVariables ( )
protectedvirtual
bool mic::applications::MNISTPatchSoftmaxApplication::performLearningStep ( )
protectedvirtual
void mic::applications::MNISTPatchSoftmaxApplication::populateTestStatistics ( )
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.

Here is the call graph for this function:

Member Data Documentation

mic::configuration::Property<std::string> mic::applications::MNISTPatchSoftmaxApplication::autoencoder_filename
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().

mic::configuration::Property<size_t> mic::applications::MNISTPatchSoftmaxApplication::autoencoder_layers_to_be_removed
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().

mic::utils::DataCollectorPtr<std::string, float> mic::applications::MNISTPatchSoftmaxApplication::collector_ptr
private

Data collector.

Definition at line 129 of file MNISTPatchSoftmaxApplication.hpp.

Referenced by collectTestStatistics(), initialize(), and performLearningStep().

mic::types::MatrixXfPtr mic::applications::MNISTPatchSoftmaxApplication::decoded_prediction
private

Probability.

Definition at line 120 of file MNISTPatchSoftmaxApplication.hpp.

Referenced by initializePropertyDependentVariables().

mic::types::MatrixXfPtr mic::applications::MNISTPatchSoftmaxApplication::input_image
private

Input image/matrix.

Definition at line 117 of file MNISTPatchSoftmaxApplication.hpp.

Referenced by initializePropertyDependentVariables().

mic::types::MatrixXfPtr mic::applications::MNISTPatchSoftmaxApplication::input_target
private

Probability.

Definition at line 123 of file MNISTPatchSoftmaxApplication.hpp.

Referenced by initializePropertyDependentVariables().

mic::encoders::UIntMatrixXfEncoder* mic::applications::MNISTPatchSoftmaxApplication::label_encoder
private
mic::encoders::MatrixXfMatrixXfEncoder* mic::applications::MNISTPatchSoftmaxApplication::mnist_encoder
private
BackpropagationNeuralNetwork<float> mic::applications::MNISTPatchSoftmaxApplication::neural_net
private
size_t mic::applications::MNISTPatchSoftmaxApplication::patch_size
private

Size of the patch - copied from importers.

Definition at line 126 of file MNISTPatchSoftmaxApplication.hpp.

Referenced by initializePropertyDependentVariables().

mic::configuration::Property<std::string> mic::applications::MNISTPatchSoftmaxApplication::softmax_filename
private

Property: name of the file with softmax nn.

Definition at line 138 of file MNISTPatchSoftmaxApplication.hpp.

Referenced by initializePropertyDependentVariables(), MNISTPatchSoftmaxApplication(), and populateTestStatistics().

mic::configuration::Property<bool> mic::applications::MNISTPatchSoftmaxApplication::softmax_load
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().

mic::configuration::Property<bool> mic::applications::MNISTPatchSoftmaxApplication::softmax_save
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().

mic::importers::MNISTPatchImporter* mic::applications::MNISTPatchSoftmaxApplication::test_dataset_importer
private

Importer responsible for loading testing dataset.

Definition at line 99 of file MNISTPatchSoftmaxApplication.hpp.

Referenced by collectTestStatistics(), initializePropertyDependentVariables(), MNISTPatchSoftmaxApplication(), and ~MNISTPatchSoftmaxApplication().

mic::importers::MNISTPatchImporter* mic::applications::MNISTPatchSoftmaxApplication::training_dataset_importer
private

Importer responsible for loading training dataset.

Definition at line 96 of file MNISTPatchSoftmaxApplication.hpp.

Referenced by initializePropertyDependentVariables(), MNISTPatchSoftmaxApplication(), performLearningStep(), and ~MNISTPatchSoftmaxApplication().

WindowMatrix2D* mic::applications::MNISTPatchSoftmaxApplication::w2d_input
private

Window for displaying the input image.

Definition at line 108 of file MNISTPatchSoftmaxApplication.hpp.

Referenced by initialize(), initializePropertyDependentVariables(), and ~MNISTPatchSoftmaxApplication().

WindowCollectorChart<float>* mic::applications::MNISTPatchSoftmaxApplication::w_chart
private

Window for displaying chart with statistics.

Definition at line 111 of file MNISTPatchSoftmaxApplication.hpp.

Referenced by initialize(), and ~MNISTPatchSoftmaxApplication().

WindowProbability* mic::applications::MNISTPatchSoftmaxApplication::w_prob
private

Window displaying the probabilities.

Definition at line 114 of file MNISTPatchSoftmaxApplication.hpp.

Referenced by initialize(), initializePropertyDependentVariables(), and ~MNISTPatchSoftmaxApplication().


The documentation for this class was generated from the following files: