panann
Classes | Public Member Functions | Protected Member Functions | List of all members
panann::NeuronContainer Class Reference

#include <NeuronContainer.h>

Inheritance diagram for panann::NeuronContainer:
Inheritance graph
[legend]

Classes

struct  Neuron
 

Public Member Functions

 NeuronContainer (const NeuronContainer &)=delete
 
NeuronContaineroperator= (const NeuronContainer &)=delete
 
void SetInputNeuronCount (size_t input_neuron_count)
 
size_t GetInputNeuronCount () const
 
void SetOutputNeuronCount (size_t output_neuron_count)
 
size_t GetOutputNeuronCount () const
 
size_t GetNeuronCount () const
 
const NeuronGetNeuron (size_t neuron_index) const
 

Protected Member Functions

size_t GetHiddenNeuronStartIndex () const
 
size_t GetInputNeuronStartIndex () const
 
size_t GetOutputNeuronStartIndex () const
 
size_t GetBiasNeuronStartIndex () const
 
size_t GetHiddenNeuronCount () const
 
size_t GetBiasNeuronCount () const
 
size_t AddHiddenNeurons (size_t count)
 
void AddBiasNeurons (size_t count)
 
void AllocateNeurons ()
 
bool AreNeuronsAllocated () const
 
void SetNeuronActivationFunction (size_t neuron_index, ActivationFunctionType type)
 
NeuronGetNeuron (size_t neuron_index)
 
NeuronGetInputNeuron (size_t input_neuron_index)
 
NeuronGetOutputNeuron (size_t output_neuron_index)
 
NeuronGetBiasNeuron (size_t bias_neuron_index)
 
NeuronGetHiddenNeuron (size_t hidden_neuron_index)
 
const NeuronGetOutputNeuron (size_t output_neuron_index) const
 

Detailed Description

Container for storing and lightly organizing a set of neurons.
Intended mainly to act as a base class for artificial neural networks and facilitate neuron storage for the same.

All of the neurons are physically stored in a vector.
All of the hidden neurons are stored first, starting at index 0 and continuing for GetHiddenNeuronCount() neurons, stored sequentially.
Immediately following the hidden neurons are all of the input, output, and bias neurons.

+-----------------------------------------------—+-------------------—+ | Index | Which Neuron | +-----------------------------------------------—+-------------------—+ | GetHiddenNeuronStartIndex() | First Hidden Neuron | +-----------------------------------------------—+-------------------—+ | GetHiddenNeuronStartIndex() + 1 | Second Hidden Neuron | +-----------------------------------------------—+-------------------—+ | ... | | +-----------------------------------------------—+-------------------—+ | GetHiddenNeuronStartIndex() | Last Hidden Neuron | | + GetHiddenNeuronCount() - 1 | | +-----------------------------------------------—+-------------------—+ | GetInputNeuronStartIndex() | First Input Neuron | +-----------------------------------------------—+-------------------—+ | GetInputNeuronStartIndex() + 1 | Second Input Neuron | +-----------------------------------------------—+-------------------—+ | ... | | +-----------------------------------------------—+-------------------—+ | GetInputNeuronStartIndex() | Last Input Neuron | | + GetInputNeuronCount() - 1 | | +-----------------------------------------------—+-------------------—+ | GetOutputNeuronStartIndex() | First Output Neuron | +-----------------------------------------------—+-------------------—+ | GetOutputNeuronStartIndex() + 1 | Second Output Neuron | +-----------------------------------------------—+-------------------—+ | ... | | +-----------------------------------------------—+-------------------—+ | GetOutputNeuronStartIndex() | Last Output Neuron | | + GetOutputNeuronCount() - 1 | | +-----------------------------------------------—+-------------------—+ | GetBiasNeuronStartIndex() | First Bias Neuron | +-----------------------------------------------—+-------------------—+ | GetBiasNeuronStartIndex() + 1 | Second Bias Neuron | +-----------------------------------------------—+-------------------—+ | ... | | +-----------------------------------------------—+-------------------—+ | GetBiasNeuronStartIndex() | Last Bias Neuron | | + GetBiasNeuronCount() - 1 | | +-----------------------------------------------—+-------------------—+

Member Function Documentation

◆ AddBiasNeurons()

void panann::NeuronContainer::AddBiasNeurons ( size_t  count)
protected

Adds |count| bias neurons to the container.
Note: There isn't a way to remove neurons once they're added.

◆ AddHiddenNeurons()

size_t panann::NeuronContainer::AddHiddenNeurons ( size_t  count)
protected

Adds |count| hidden neurons to the container.
Note: There isn't a way to remove neurons once they're added.

Returns
Index at which the new neurons begin.

◆ AllocateNeurons()

void panann::NeuronContainer::AllocateNeurons ( )
protected

Perform allocation of the vector of neurons. Note: Do this before attempting to use the neurons.

◆ AreNeuronsAllocated()

bool panann::NeuronContainer::AreNeuronsAllocated ( ) const
protected

Returns true if the neurons in the container have been allocated.

◆ GetBiasNeuron()

NeuronContainer::Neuron & panann::NeuronContainer::GetBiasNeuron ( size_t  bias_neuron_index)
protected

Get a writable view of the bias neuron at index |bias_neuron_index|. Note: |bias_neuron_index| is not a global index into |neurons_| but must be in the range [0, GetBiasNeuronCount()).

◆ GetBiasNeuronCount()

size_t panann::NeuronContainer::GetBiasNeuronCount ( ) const
protected

Get the count of bias neurons in the container.

◆ GetBiasNeuronStartIndex()

size_t panann::NeuronContainer::GetBiasNeuronStartIndex ( ) const
protected

Get the index of the first bias neuron. Following this index, there will be GetBiasNeuronCount() more bias neurons.

See also
GetBiasNeuronCount

◆ GetHiddenNeuron()

NeuronContainer::Neuron & panann::NeuronContainer::GetHiddenNeuron ( size_t  hidden_neuron_index)
protected

Get a writable view of the hidden neuron at index |hidden_neuron_index|. Note: |hidden_neuron_index| is not a global index into |neurons_| but must be in the range [0, GetHiddenNeuronCount()).

◆ GetHiddenNeuronCount()

size_t panann::NeuronContainer::GetHiddenNeuronCount ( ) const
protected

Get the count of hidden neurons in the container.

◆ GetHiddenNeuronStartIndex()

size_t panann::NeuronContainer::GetHiddenNeuronStartIndex ( ) const
protected

Get the index of the first hidden neuron. Following this index, there will be GetHiddenNeuronCount() more hidden neurons.

See also
GetHiddenNeuronCount

◆ GetInputNeuron()

NeuronContainer::Neuron & panann::NeuronContainer::GetInputNeuron ( size_t  input_neuron_index)
protected

Get a writable view of the input neuron at index |input_neuron_index|. Note: |input_neuron_index| is not a global index into |neurons_| but must be in the range [0, GetInputNeuronCount()).

◆ GetInputNeuronCount()

size_t panann::NeuronContainer::GetInputNeuronCount ( ) const

Get the count of input neurons in the container.

◆ GetInputNeuronStartIndex()

size_t panann::NeuronContainer::GetInputNeuronStartIndex ( ) const
protected

Get the index of the first input neuron. Following this index, there will be GetInputNeuronCount() more input neurons.

See also
GetInputNeuronCount

◆ GetNeuron() [1/2]

NeuronContainer::Neuron & panann::NeuronContainer::GetNeuron ( size_t  neuron_index)
protected

Get a writable view of the neuron at |neuron_index|.

◆ GetNeuron() [2/2]

const NeuronContainer::Neuron & panann::NeuronContainer::GetNeuron ( size_t  neuron_index) const

Get a read-only view of the neuron at |neuron_index|.

◆ GetNeuronCount()

size_t panann::NeuronContainer::GetNeuronCount ( ) const

Get the total count of neurons in the container. Note: The neurons must have been allocated.

◆ GetOutputNeuron() [1/2]

NeuronContainer::Neuron & panann::NeuronContainer::GetOutputNeuron ( size_t  output_neuron_index)
protected

Get a writable view of the output neuron at index |output_neuron_index|. Note: |output_neuron_index| is not a global index into |neurons_| but must be in the range [0, GetOutputNeuronCount()).

◆ GetOutputNeuron() [2/2]

const NeuronContainer::Neuron & panann::NeuronContainer::GetOutputNeuron ( size_t  output_neuron_index) const
protected

Get a read-only view of the output neuron at index |output_neuron_index|. Note: |output_neuron_index| is not a global index into |neurons_| but must be in the range [0, GetOutputNeuronCount()).

◆ GetOutputNeuronCount()

size_t panann::NeuronContainer::GetOutputNeuronCount ( ) const

Get the count of output neurons in the container.

◆ GetOutputNeuronStartIndex()

size_t panann::NeuronContainer::GetOutputNeuronStartIndex ( ) const
protected

Get the index of the first output neuron. Following this index, there will be GetOutputNeuronCount() more output neurons.

See also
GetOutputNeuronCount

◆ SetInputNeuronCount()

void panann::NeuronContainer::SetInputNeuronCount ( size_t  input_neuron_count)

Set the number of input neurons in the container. This count may not be changed once the neurons have been allocated.

◆ SetNeuronActivationFunction()

void panann::NeuronContainer::SetNeuronActivationFunction ( size_t  neuron_index,
ActivationFunctionType  type 
)
protected

Set the activation function which will be used for the neuron at |neuron_index|.

◆ SetOutputNeuronCount()

void panann::NeuronContainer::SetOutputNeuronCount ( size_t  output_neuron_count)

Set the number of output neurons in the container. This count may not be changed once the neurons have been allocated.


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