Cpp ML Library  1.0.0
A library of Machine Learning Algorithmns seen from the Udemy course Machine Learning A to Z.
Public Member Functions | List of all members
Neuron Class Reference

Represents a single neuron in the neural network. More...

#include <NeuralNetwork.hpp>

Public Member Functions

 Neuron (unsigned numOutputs, unsigned index)
 Constructs a Neuron. More...
 
void setOutputVal (double val)
 Sets the output value of the neuron. More...
 
double getOutputVal () const
 Gets the output value of the neuron. More...
 
void feedForward (const std::vector< Neuron > &prevLayer)
 Feeds forward the input values to the next layer. More...
 
void calcOutputGradients (double targetVal)
 Calculates the output gradients for the output layer. More...
 
void calcHiddenGradients (const std::vector< Neuron > &nextLayer)
 Calculates the hidden gradients for hidden layers. More...
 
void updateInputWeights (std::vector< Neuron > &prevLayer)
 Updates the input weights for the neuron. More...
 

Detailed Description

Represents a single neuron in the neural network.

Constructor & Destructor Documentation

◆ Neuron()

Neuron::Neuron ( unsigned  numOutputs,
unsigned  index 
)

Constructs a Neuron.

Parameters
numOutputsThe number of outputs from this neuron.
indexThe index of this neuron in its layer.

Member Function Documentation

◆ calcHiddenGradients()

void Neuron::calcHiddenGradients ( const std::vector< Neuron > &  nextLayer)

Calculates the hidden gradients for hidden layers.

Parameters
nextLayerThe next layer of neurons.

◆ calcOutputGradients()

void Neuron::calcOutputGradients ( double  targetVal)

Calculates the output gradients for the output layer.

Parameters
targetValThe target value.

◆ feedForward()

void Neuron::feedForward ( const std::vector< Neuron > &  prevLayer)

Feeds forward the input values to the next layer.

Parameters
prevLayerThe previous layer of neurons.

◆ getOutputVal()

double Neuron::getOutputVal ( ) const

Gets the output value of the neuron.

Returns
The output value.

◆ setOutputVal()

void Neuron::setOutputVal ( double  val)

Sets the output value of the neuron.

Parameters
valThe value to set.

◆ updateInputWeights()

void Neuron::updateInputWeights ( std::vector< Neuron > &  prevLayer)

Updates the input weights for the neuron.

Parameters
prevLayerThe previous layer of neurons.

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