MachineIntelligenceCore:NeuralNets
|
Class representing a multi-layer neural network based on hebbian learning. More...
#include <HebbianNeuralNetwork.hpp>
Public Member Functions | |
HebbianNeuralNetwork (std::string name_="hebbian_net") | |
virtual | ~HebbianNeuralNetwork () |
Virtual descriptor - empty. More... | |
void | forward (mic::types::MatrixPtr< eT > input_data, bool skip_dropout=false) |
eT | train (mic::types::MatrixPtr< eT > encoded_batch_, eT learning_rate_) |
eT | test (mic::types::MatrixPtr< eT > encoded_batch_) |
![]() | |
MultiLayerNeuralNetwork (std::string name_="mlnn") | |
virtual | ~MultiLayerNeuralNetwork () |
template<typename LayerType > | |
void | pushLayer (LayerType *layer_ptr_) |
template<typename LayerType > | |
std::shared_ptr< LayerType > | getLayer (size_t index_) |
std::shared_ptr< Layer< eT > > | getLayer (size_t index_) |
void | popLayer (size_t number_of_layers_=1) |
size_t | layerInputsSize (size_t layer_number_=-1) |
size_t | lastLayerOutputsSize (size_t layer_number_=-1) |
size_t | lastLayerBatchSize (size_t layer_number_=-1) |
template<typename omT > | |
void | setOptimization () |
void | update (eT alpha_, eT decay_=0.0f) |
void | resetGrads () |
void | resizeBatch (size_t batch_size_) |
mic::types::MatrixPtr< eT > | getPredictions () |
mic::types::MatrixPtr< eT > | getPredictions (size_t layer_nr_) |
size_t | countCorrectPredictions (mic::types::MatrixPtr< eT > targets_, mic::types::MatrixPtr< eT > predictions_) |
bool | save (std::string filename_) |
bool | load (std::string filename_) |
Additional Inherited Members | |
![]() | |
std::vector< std::shared_ptr < mic::mlnn::Layer< eT > > > | layers |
std::string | name |
bool | connected |
Flag denoting whether the layers are interconnected, thus no copying between inputs and outputs of the neighboring layers will be required. More... | |
Class representing a multi-layer neural network based on hebbian learning.
eT | Template parameter denoting precision of variables (float for calculations/double for testing). |
Definition at line 41 of file HebbianNeuralNetwork.hpp.
|
inline |
Constructor. Sets the neural network name.
name_ | Name of the network. |
Definition at line 49 of file HebbianNeuralNetwork.hpp.
|
inlinevirtual |
Virtual descriptor - empty.
Definition at line 57 of file HebbianNeuralNetwork.hpp.
|
inline |
Passes the data in a feed-forward manner through all consecutive layers, from the input to the output layer.
input_data | Input data - a matrix containing [sample_size x batch_size]. |
skip_dropout | Flag for skipping dropouts - which should be set to true during testing. |
Definition at line 65 of file HebbianNeuralNetwork.hpp.
References mic::mlnn::MultiLayerNeuralNetwork< eT >::connected, mic::mlnn::MultiLayerNeuralNetwork< eT >::layers, and mic::mlnn::MultiLayerNeuralNetwork< eT >::resizeBatch().
Referenced by mic::mlnn::HebbianNeuralNetwork< eT >::test(), and mic::mlnn::HebbianNeuralNetwork< eT >::train().
|
inline |
Tests the neural network with a given batch.
encoded_batch_ | Batch encoded in the form of matrix of size [sample_size x batch_size]. |
encoded_targets_ | Targets (labels) encoded in the form of matrix of size [label_size x batch_size]. |
Definition at line 140 of file HebbianNeuralNetwork.hpp.
References mic::mlnn::HebbianNeuralNetwork< eT >::forward().
|
inline |
Trains the neural network with a given batch.
encoded_batch_ | Batch encoded in the form of matrix of size [sample_size x batch_size]. |
learning_rate_ | The learning rate. |
Definition at line 118 of file HebbianNeuralNetwork.hpp.
References mic::mlnn::HebbianNeuralNetwork< eT >::forward(), and mic::mlnn::MultiLayerNeuralNetwork< eT >::update().