Neuron Net
Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
CNeuronBase Class Reference

The base class of neuron.
. More...

Inheritance diagram for CNeuronBase:
CNeuron CNeuronProof CNeuronConv CNeuronLSTM

Public Member Functions

 CNeuronBase (void)
 Constructor. More...
 
 ~CNeuronBase (void)
 Destructor. More...
 
virtual bool Init (uint numOutputs, uint myIndex, ENUM_OPTIMIZATION optimization_type)
 Method of initialization class. More...
 
virtual void SetActivationFunction (ENUM_ACTIVATION value)
 Set the type of activation function (ENUM_ACTIVATION) More...
 
virtual void setOutputVal (double val)
 Set the output value. More...
 
virtual double getOutputVal ()
 Return result of feed forward operations. More...
 
virtual double getPrevVal ()
 Return result of feed forward operations at previous iteration. More...
 
virtual void setGradient (double val)
 Set gradient value to neuron. More...
 
virtual double getGradient ()
 Return gradient of neuron. More...
 
virtual CArrayCongetConnections ()
 Method to get access to array of connections. More...
 
virtual double activationFunctionDerivative (double x)
 Calculate derivative of activation function. More...
 
virtual double SigmoidFunctionDerivative (double x)
 Calculate derivative of Sigmoid function. More...
 
virtual double TanhFunctionDerivative (double x)
 Calculate derivative of \(tanh(x)\). More...
 
virtual bool feedForward (CObject *&SourceObject)
 Dispatch method for defining the subroutine for Feed Forward process. More...
 
virtual bool calcHiddenGradients (CObject *&TargetObject)
 Dispatch method for defining the subroutine for transfer gradient to previous layer. More...
 
virtual bool updateInputWeights (CObject *&SourceObject)
 Dispatch method for defining the subroutine for updating weights. More...
 
virtual bool Save (int const file_handle)
 Save method. More...
 
virtual bool Load (int const file_handle)
 
virtual int Type (void) const
 Identificator of class. More...
 

Static Public Attributes

static double alpha =0.8
 Multiplier to momentum in SGD optimization. More...
 

Protected Member Functions

virtual bool feedForward (CLayer *prevLayer)
 Feed Forward method. More...
 
virtual bool calcHiddenGradients (CLayer *&nextLayer)
 Method to transfer gradient to previous layer. More...
 
virtual bool updateInputWeights (CLayer *&prevLayer)
 Method for updating weights. More...
 
virtual double activationFunction (double x)
 Method to calculate activation function. More...
 
virtual double SigmoidFunction (double x)
 Calculating Sigmoid \(\frac{1}{1+e^x}\). More...
 
virtual double TanhFunction (double x)
 Calculating \(tanh(x)\). More...
 
virtual CLayergetOutputLayer (void)
 Method for getting a pointer to the resulting neural layer. Not used in fully connected neural networks. More...
 

Protected Attributes

double outputVal
 Output value. More...
 
double prevVal
 Previous output value. More...
 
uint m_myIndex
 Index of neuron in layer. More...
 
double gradient
 Current gradient of neuron. More...
 
CArrayConConnections
 Array of connections with neurons in next layer. More...
 
ENUM_ACTIVATION activation
 Activation type (ENUM_ACTIVATION) More...
 
ENUM_OPTIMIZATION optimization
 Optimization method (ENUM_OPTIMIZATION) More...
 
int t
 Count of iterations. More...
 

Detailed Description

The base class of neuron.
.

Detailed description on the link.

Definition at line 403 of file NeuroNet.mqh.

Constructor & Destructor Documentation

◆ CNeuronBase()

CNeuronBase::CNeuronBase ( void  )

Constructor.

Definition at line 462 of file NeuroNet.mqh.

◆ ~CNeuronBase()

CNeuronBase::~CNeuronBase ( void  )

Destructor.

Definition at line 473 of file NeuroNet.mqh.

Member Function Documentation

◆ activationFunction()

double CNeuronBase::activationFunction ( double  x)
protectedvirtual

Method to calculate activation function.

Parameters
xInput data.
Returns
Result of activation function.

Reimplemented in CNeuronConv.

Definition at line 2656 of file NeuroNet.mqh.

◆ activationFunctionDerivative()

double CNeuronBase::activationFunctionDerivative ( double  x)
virtual

Calculate derivative of activation function.

Parameters
[in]xInput data
Returns
Derivative

Reimplemented in CNeuronConv.

Definition at line 2673 of file NeuroNet.mqh.

◆ calcHiddenGradients() [1/2]

virtual bool CNeuronBase::calcHiddenGradients ( CLayer *&  nextLayer)
inlineprotectedvirtual

Method to transfer gradient to previous layer.

Parameters
nextLayerPointer to next layer.

Reimplemented in CNeuronLSTM, CNeuronConv, and CNeuronProof.

Definition at line 416 of file NeuroNet.mqh.

◆ calcHiddenGradients() [2/2]

bool CNeuronBase::calcHiddenGradients ( CObject *&  TargetObject)
virtual

Dispatch method for defining the subroutine for transfer gradient to previous layer.

Parameters
TargetObjectPointer to next layer.

Definition at line 952 of file NeuroNet.mqh.

◆ feedForward() [1/2]

virtual bool CNeuronBase::feedForward ( CLayer prevLayer)
inlineprotectedvirtual

Feed Forward method.

Parameters
prevLayerPointer to previos layer.

Reimplemented in CNeuronLSTM, CNeuronConv, and CNeuronProof.

Definition at line 415 of file NeuroNet.mqh.

◆ feedForward() [2/2]

bool CNeuronBase::feedForward ( CObject *&  SourceObject)
virtual

Dispatch method for defining the subroutine for Feed Forward process.

Parameters
SourceObjectPointer to previos layer.

Definition at line 852 of file NeuroNet.mqh.

◆ getConnections()

virtual CArrayCon* CNeuronBase::getConnections ( )
inlinevirtual

Method to get access to array of connections.

Returns
Pointer to connections array

Definition at line 436 of file NeuroNet.mqh.

◆ getGradient()

virtual double CNeuronBase::getGradient ( )
inlinevirtual

Return gradient of neuron.

Returns
Gradient

Definition at line 435 of file NeuroNet.mqh.

◆ getOutputLayer()

virtual CLayer* CNeuronBase::getOutputLayer ( void  )
inlineprotectedvirtual

Method for getting a pointer to the resulting neural layer. Not used in fully connected neural networks.

Returns
Pointer to layer.

Reimplemented in CNeuronLSTM, and CNeuronProof.

Definition at line 421 of file NeuroNet.mqh.

◆ getOutputVal()

virtual double CNeuronBase::getOutputVal ( )
inlinevirtual

Return result of feed forward operations.

Returns
Output value

Definition at line 432 of file NeuroNet.mqh.

◆ getPrevVal()

virtual double CNeuronBase::getPrevVal ( )
inlinevirtual

Return result of feed forward operations at previous iteration.

Returns
Previous output value

Definition at line 433 of file NeuroNet.mqh.

◆ Init()

bool CNeuronBase::Init ( uint  numOutputs,
uint  myIndex,
ENUM_OPTIMIZATION  optimization_type 
)
virtual

Method of initialization class.

Parameters
numOutputsNumber of connections to next layer.
myIndexIndex of neuron in layer.
optimization_typeOptimization type (ENUM_OPTIMIZATION)
Returns
Boolen result of operations.

Definition at line 481 of file NeuroNet.mqh.

◆ Load()

virtual bool CNeuronBase::Load ( int const  file_handle)
inlinevirtual
Parameters
file_handleLoad method
[in]file_handlehandle of file
Returns
logical result of operation

Reimplemented in CNeuronLSTM, CNeuronConv, and CNeuronProof.

Definition at line 446 of file NeuroNet.mqh.

◆ Save()

bool CNeuronBase::Save ( int const  file_handle)
virtual

Save method.

Parameters
[in]file_handlehandle of file
Returns
logical result of operation

Reimplemented in CNeuronLSTM, CNeuronConv, and CNeuronProof.

Definition at line 1301 of file NeuroNet.mqh.

◆ SetActivationFunction()

virtual void CNeuronBase::SetActivationFunction ( ENUM_ACTIVATION  value)
inlinevirtual

Set the type of activation function (ENUM_ACTIVATION)

Definition at line 426 of file NeuroNet.mqh.

◆ setGradient()

virtual void CNeuronBase::setGradient ( double  val)
inlinevirtual

Set gradient value to neuron.

Definition at line 434 of file NeuroNet.mqh.

◆ setOutputVal()

virtual void CNeuronBase::setOutputVal ( double  val)
inlinevirtual

Set the output value.

Definition at line 431 of file NeuroNet.mqh.

◆ SigmoidFunction()

virtual double CNeuronBase::SigmoidFunction ( double  x)
inlineprotectedvirtual

Calculating Sigmoid \(\frac{1}{1+e^x}\).

Parameters
xInput data.
Returns
Result of calculation

Definition at line 419 of file NeuroNet.mqh.

◆ SigmoidFunctionDerivative()

virtual double CNeuronBase::SigmoidFunctionDerivative ( double  x)
inlinevirtual

Calculate derivative of Sigmoid function.

Parameters
xInput data
Returns
Derivative

Definition at line 438 of file NeuroNet.mqh.

◆ TanhFunction()

virtual double CNeuronBase::TanhFunction ( double  x)
inlineprotectedvirtual

Calculating \(tanh(x)\).

Parameters
xInput data.
Returns
Result of calculation

Definition at line 420 of file NeuroNet.mqh.

◆ TanhFunctionDerivative()

virtual double CNeuronBase::TanhFunctionDerivative ( double  x)
inlinevirtual

Calculate derivative of \(tanh(x)\).

Parameters
xInput data
Returns
Derivative

Definition at line 439 of file NeuroNet.mqh.

◆ Type()

virtual int CNeuronBase::Type ( void  ) const
inlinevirtual

Identificator of class.

Returns
Type of class

Reimplemented in CNeuronLSTM, CNeuronConv, CNeuronProof, and CNeuron.

Definition at line 452 of file NeuroNet.mqh.

◆ updateInputWeights() [1/2]

virtual bool CNeuronBase::updateInputWeights ( CLayer *&  prevLayer)
inlineprotectedvirtual

Method for updating weights.

Parameters
prevLayerPointer to previos layer.

Reimplemented in CNeuronLSTM, and CNeuronConv.

Definition at line 417 of file NeuroNet.mqh.

◆ updateInputWeights() [2/2]

bool CNeuronBase::updateInputWeights ( CObject *&  SourceObject)
virtual

Dispatch method for defining the subroutine for updating weights.

Parameters
SourceObjectPointer to previos layer.

Definition at line 880 of file NeuroNet.mqh.

Member Data Documentation

◆ activation

ENUM_ACTIVATION CNeuronBase::activation
protected

Activation type (ENUM_ACTIVATION)

Definition at line 411 of file NeuroNet.mqh.

◆ alpha

double CNeuronBase::alpha =0.8
static

Multiplier to momentum in SGD optimization.

Definition at line 429 of file NeuroNet.mqh.

◆ Connections

CArrayCon* CNeuronBase::Connections
protected

Array of connections with neurons in next layer.

Definition at line 410 of file NeuroNet.mqh.

◆ gradient

double CNeuronBase::gradient
protected

Current gradient of neuron.

Definition at line 409 of file NeuroNet.mqh.

◆ m_myIndex

uint CNeuronBase::m_myIndex
protected

Index of neuron in layer.

Definition at line 408 of file NeuroNet.mqh.

◆ optimization

ENUM_OPTIMIZATION CNeuronBase::optimization
protected

Optimization method (ENUM_OPTIMIZATION)

Definition at line 412 of file NeuroNet.mqh.

◆ outputVal

double CNeuronBase::outputVal
protected

Output value.

Definition at line 406 of file NeuroNet.mqh.

◆ prevVal

double CNeuronBase::prevVal
protected

Previous output value.

Definition at line 407 of file NeuroNet.mqh.

◆ t

int CNeuronBase::t
protected

Count of iterations.

Definition at line 413 of file NeuroNet.mqh.


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