panann
|
#include <NeuronContainer.h>
Classes | |
struct | Neuron |
Public Member Functions | |
NeuronContainer (const NeuronContainer &)=delete | |
NeuronContainer & | operator= (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 Neuron & | GetNeuron (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) |
Neuron & | GetNeuron (size_t neuron_index) |
Neuron & | GetInputNeuron (size_t input_neuron_index) |
Neuron & | GetOutputNeuron (size_t output_neuron_index) |
Neuron & | GetBiasNeuron (size_t bias_neuron_index) |
Neuron & | GetHiddenNeuron (size_t hidden_neuron_index) |
const Neuron & | GetOutputNeuron (size_t output_neuron_index) const |
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 | | +-----------------------------------------------—+-------------------—+
|
protected |
Adds |count| bias neurons to the container.
Note: There isn't a way to remove neurons once they're added.
|
protected |
Adds |count| hidden neurons to the container.
Note: There isn't a way to remove neurons once they're added.
|
protected |
Perform allocation of the vector of neurons. Note: Do this before attempting to use the neurons.
|
protected |
Returns true if the neurons in the container have been allocated.
|
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()).
|
protected |
Get the count of bias neurons in the container.
|
protected |
Get the index of the first bias neuron. Following this index, there will be GetBiasNeuronCount() more bias neurons.
|
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()).
|
protected |
Get the count of hidden neurons in the container.
|
protected |
Get the index of the first hidden neuron. Following this index, there will be GetHiddenNeuronCount() more hidden neurons.
|
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()).
size_t panann::NeuronContainer::GetInputNeuronCount | ( | ) | const |
Get the count of input neurons in the container.
|
protected |
Get the index of the first input neuron. Following this index, there will be GetInputNeuronCount() more input neurons.
|
protected |
Get a writable view of the neuron at |neuron_index|.
const NeuronContainer::Neuron & panann::NeuronContainer::GetNeuron | ( | size_t | neuron_index | ) | const |
Get a read-only view of the neuron at |neuron_index|.
size_t panann::NeuronContainer::GetNeuronCount | ( | ) | const |
Get the total count of neurons in the container. Note: The neurons must have been allocated.
|
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()).
|
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()).
size_t panann::NeuronContainer::GetOutputNeuronCount | ( | ) | const |
Get the count of output neurons in the container.
|
protected |
Get the index of the first output neuron. Following this index, there will be GetOutputNeuronCount() more output neurons.
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.
|
protected |
Set the activation function which will be used for the neuron at |neuron_index|.
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.