MachineIntelligenceCore:NeuralNets
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
mic::mlnn::HebbianNeuralNetwork< eT > Class Template Reference

Class representing a multi-layer neural network based on hebbian learning. More...

#include <HebbianNeuralNetwork.hpp>

Inheritance diagram for mic::mlnn::HebbianNeuralNetwork< eT >:
Collaboration diagram for mic::mlnn::HebbianNeuralNetwork< eT >:

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_)
 
- Public Member Functions inherited from mic::mlnn::MultiLayerNeuralNetwork< eT >
 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

- Protected Attributes inherited from mic::mlnn::MultiLayerNeuralNetwork< eT >
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...
 

Detailed Description

template<typename eT>
class mic::mlnn::HebbianNeuralNetwork< eT >

Class representing a multi-layer neural network based on hebbian learning.

Author
tkornuta
Template Parameters
eTTemplate parameter denoting precision of variables (float for calculations/double for testing).

Definition at line 41 of file HebbianNeuralNetwork.hpp.

Constructor & Destructor Documentation

template<typename eT >
mic::mlnn::HebbianNeuralNetwork< eT >::HebbianNeuralNetwork ( std::string  name_ = "hebbian_net")
inline

Constructor. Sets the neural network name.

Parameters
name_Name of the network.

Definition at line 49 of file HebbianNeuralNetwork.hpp.

template<typename eT >
virtual mic::mlnn::HebbianNeuralNetwork< eT >::~HebbianNeuralNetwork ( )
inlinevirtual

Virtual descriptor - empty.

Definition at line 57 of file HebbianNeuralNetwork.hpp.

Member Function Documentation

template<typename eT >
void mic::mlnn::HebbianNeuralNetwork< eT >::forward ( mic::types::MatrixPtr< eT >  input_data,
bool  skip_dropout = false 
)
inline

Passes the data in a feed-forward manner through all consecutive layers, from the input to the output layer.

Parameters
input_dataInput data - a matrix containing [sample_size x batch_size].
skip_dropoutFlag 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().

Here is the call graph for this function:

template<typename eT >
eT mic::mlnn::HebbianNeuralNetwork< eT >::test ( mic::types::MatrixPtr< eT >  encoded_batch_)
inline

Tests the neural network with a given batch.

Parameters
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].
Returns
Loss computed according to the selected loss function. If function not set - returns INF.

Definition at line 140 of file HebbianNeuralNetwork.hpp.

References mic::mlnn::HebbianNeuralNetwork< eT >::forward().

Here is the call graph for this function:

template<typename eT >
eT mic::mlnn::HebbianNeuralNetwork< eT >::train ( mic::types::MatrixPtr< eT >  encoded_batch_,
eT  learning_rate_ 
)
inline

Trains the neural network with a given batch.

Parameters
encoded_batch_Batch encoded in the form of matrix of size [sample_size x batch_size].
learning_rate_The learning rate.
Returns
Loss computed according to the selected loss function. If function not set - returns INF.

Definition at line 118 of file HebbianNeuralNetwork.hpp.

References mic::mlnn::HebbianNeuralNetwork< eT >::forward(), and mic::mlnn::MultiLayerNeuralNetwork< eT >::update().

Here is the call graph for this function:


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