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).
|
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... | |
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.
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.
topology | A vector representing the number of neurons in each layer. |
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.
targetVals | A 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.
targetVals | A vector containing the target values for output neurons. |
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.
inputVals | A 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.
inputVals | A vector containing input values for the network. |
|
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.
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.
resultVals | A 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.
resultVals | A reference to a vector where output values will be stored. |
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.
topology | A vector representing the number of neurons in each layer. |