Skip to content

LSTMNode Class

This class is responsible for managing all LSTM nodes. The difference between normal hidden nodes and LSTM nodes is the existance of a connection between every LSTM node in the same layer, known as the previous/next LSTM nodes. Each LSTM node also has 4 gate networks necessary for it's function, making it considerably larger than normal nodes.

LSTMNode .new(string activName, number bias, number learningRate, LSTMNode prevLSTMNode = nil, LSTMNode nextLSTMNode = nil, number numOfInputs=1) Creates and returns the LSTMNode with the given activation function, bias, learning rate, previous/next LSTM nodes (if they exist), and number of inputs.
number :CalculateValue() Calculates the node's output value and updates the cost data.
void :ClearValue() Resets the node's output value and gate networks.
number :GetCellState() Returns the cell state.
number :GetPrevCellState() Returns the cell state of the previous LSTM node if it exists.
number :GetPrevHiddenState() Returns the hidden state of the previous LSTM node if it exists.
void :SetCellState(number cellState) Sets the cell state to !cellstate!.
LSTMNode :GetNextLSTMNode() Returns the next LSTM node if it exists.
void :SetNextLSTMNode(LSTMNode nextLSTMNode) Sets the next LSTM node to !nextLSTMNode!.
LSTMNode :GetPrevLSTMNode() Returns the previous LSTM node if it exists.
void :SetPrevLSTMNode(LSTMNode prevLSTMNode) Sets the previous LSTM node to !prevLSTMNode!.
ActivationFunction :GetActivationFunction() Returns the node's Tanh ActivationFunction.
void :AddRandomNoise(number min, number max) Adds a random noise with the minimum !min! and maximum !max! to the gate networks' parameters in the node.

Inherited from Node:

Only unchanged and unmodified functions are listed below.

void :() Fires the node and fires any node that is at it's output, potentially causing a chain reaction.

This function is fired when the Node object is called, such as:
node:()
number :GetValue() Returns the node's output value if calculated. If not, calculates it and returns the new output value.
void :SetValue(number value) Sets the node's output value to !value!.
void :AddInputSynapse(Synapse inputSynapse) Adds the synapse !inputSynapse! as an input synapse.
void :AddOutputSynapse(Synapse outputSynapse) Adds the synapse !outputSynapse! as an output synapse.
array :GetInputSynapses() Returns the input synapses.
array :GetOutputSynapses() Returns the output synapses.
void :RemoveInputSynapse(Synapse inputSynapse) Removes the input synapse !inputSynapse!.
void :RemoveOutputSynapse(Synapse outputSynapse) Removes the output synapse !inputSynapse!.
void :ClearInputSynapses() Removes all input synapses.
void :ClearOutputSynapses() Removes all output synapses.
void :SetLearningRate(number learningRate) Sets the node's learning rate to !learningRate!.
number :GetLearningRate() Returns the node's learning rate.
ActivationFunction :GetActivationFunction() Returns the node's ActivationFunction object.