Orderbook Simulation
OrderbookSim is a C++ application simulating a financial market order book. It efficiently manages and matches buy and sell orders while calculating the Volume-Weighted Average Price (VWAP).
Public Member Functions | List of all members
Net Class Reference

Represents a neural network composed of layers of neurons. More...

#include <Net.hpp>

Public Member Functions

 Net ()
 Default constructor for the Net class. More...
 
 Net (const std::vector< unsigned > topology)
 Constructs the network and sets up the topology. More...
 
void loadTopology (const std::vector< unsigned > topology)
 Sets up the network topology. More...
 
void feedForward (const std::vector< double > &inputVals)
 Performs forward propagation through the network. More...
 
void backProp (const std::vector< double > &targetVals)
 Executes backpropagation to adjust weights based on target values. More...
 
void getResults (std::vector< double > &resultVals) const
 Retrieves the output values from the final layer of the network. More...
 
double getRecentAverageError () const
 Gets the recent average error of the network. More...
 

Detailed Description

Represents a neural network composed of layers of neurons.

The Net class manages the structure and operations of a neural network, including setting up the network topology, performing forward propagation, and executing backpropagation to adjust weights based on errors.

Constructor & Destructor Documentation

◆ Net() [1/2]

Net::Net ( )
default

Default constructor for the Net class.

Initializes the Net object.

◆ Net() [2/2]

Net::Net ( const std::vector< unsigned >  topology)

Constructs the network and sets up the topology.

Initializes the network based on the provided topology, creating neurons for each layer with the specified number of outputs.

Parameters
topologyA vector representing the number of neurons in each layer.

Member Function Documentation

◆ backProp()

void Net::backProp ( const std::vector< double > &  targetVals)

Executes backpropagation to adjust weights based on target values.

Implements backpropagation to adjust weights based on target values.

Calculates the error at the output layer and propagates gradients backward to adjust weights for each layer in the network.

Parameters
targetValsA vector containing the target values for the network's output neurons.

This function calculates the overall network error (Root Mean Square) and adjusts the weights based on gradients calculated from output and hidden layers.

Parameters
targetValsA vector containing the target values for output neurons.

◆ feedForward()

void Net::feedForward ( const std::vector< double > &  inputVals)

Performs forward propagation through the network.

Feeds input values forward through the network.

Sets the input values and calculates the outputs of each neuron in subsequent layers.

Parameters
inputValsA vector containing the input values for the network.

This function sets the input values to the input layer and performs forward propagation through each layer, calculating the outputs of each neuron.

Parameters
inputValsA vector containing input values for the network.

◆ getRecentAverageError()

double Net::getRecentAverageError ( ) const
inline

Gets the recent average error of the network.

The recent average error is calculated during backpropagation to track the network's performance over time.

Returns
The recent average error.

◆ getResults()

void Net::getResults ( std::vector< double > &  resultVals) const

Retrieves the output values from the final layer of the network.

Retrieves the output values of the network.

Clears the provided vector and fills it with the network's output values.

Parameters
resultValsA reference to a vector where output values will be stored.

This function clears the resultVals vector and populates it with the output values from the last layer of neurons.

Parameters
resultValsA reference to a vector where output values will be stored.

◆ loadTopology()

void Net::loadTopology ( const std::vector< unsigned >  topology)

Sets up the network topology.

Loads the network structure based on the provided topology vector. Each entry in the vector represents the number of neurons in a layer, with additional bias neurons added.

Parameters
topologyA vector representing the number of neurons in each layer.

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