RecurrentBase

scalation.modeling.forecasting.neuralforecasting.RecurrentBase

The RecurrentBase trait defines the base structure and operations for recurrent neural networks. It includes common hyperparameters, activation functions, and methods for parameter initialization, gradient clipping, and parameter updates.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
trait RNNCell
class RNN

Members list

Type members

Classlikes

protected case class ParamGroup[T](var param: T, var velocity: T, var grad: T)

Case class representing a group of parameters, including the parameter itself, its velocity, and its gradient.

Case class representing a group of parameters, including the parameter itself, its velocity, and its gradient.

Value parameters

grad

the gradient of the parameter, used for updating the parameter during training

param

the parameter (e.g., weights or biases)

velocity

the velocity associated with the parameter, used for momentum in optimization

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Value members

Abstract methods

protected def clip_gradients(threshold: Double): Unit

Abstract method to clip the gradients of the model parameters to a specified threshold.

Abstract method to clip the gradients of the model parameters to a specified threshold.

Value parameters

threshold

the threshold value for gradient clipping

Attributes

def train(x: TensorD, y: TensorD): Unit

Abstract method for training the model with the given input and output tensors.

Abstract method for training the model with the given input and output tensors.

Value parameters

x

the input tensor

y

the output tensor

Attributes

protected def update_params(batch_size: Int, leaky: Boolean = ...): Unit

Abstract method to update the model parameters based on the gradients.

Abstract method to update the model parameters based on the gradients.

Value parameters

batch_size

the size of the batch used for training

leaky

a boolean flag indicating whether to use leaky updates (default is true)

Attributes

protected def zero_gradients(): Unit

Abstract method to zero the gradients of the model parameters.

Abstract method to zero the gradients of the model parameters.

Attributes

Concrete methods

protected def initializeBiasGroup(size: Int): ParamGroup[VectorD]

Initialize a bias group with a specified size.

Initialize a bias group with a specified size.

Value parameters

size

the size of the bias vector

Attributes

Returns

A ParamGroup containing the initialized bias vector, velocity vector, and gradient vector

protected def initializeParamGroup(rows: Int, cols: Int, stdDev: Double): ParamGroup[MatrixD]

Initialize a parameter group with a specified number of rows, columns, and standard deviation.

Initialize a parameter group with a specified number of rows, columns, and standard deviation.

Value parameters

cols

the number of columns in the parameter matrix

rows

the number of rows in the parameter matrix

stdDev

the standard deviation for initializing the parameter matrix

Attributes

Returns

A ParamGroup containing the initialized parameter matrix, velocity matrix, and gradient matrix

def log_(x: VectorD): VectorD
def log_(x: MatrixD): MatrixD
def tanh_(t: VectorD): VectorD
def tanh_(x: MatrixD): MatrixD
protected def updateBatch(matrix: MatrixD, batch_start: Int, batch_end: Int, newBatch: MatrixD): Unit

Updates a specific batch of rows in a matrix with new values.

Updates a specific batch of rows in a matrix with new values.

Value parameters

batch_end

the ending index (exclusive) of the batch in the matrix

batch_start

the starting index of the batch in the matrix

matrix

the matrix to be updated

newBatch

the new matrix containing the values to be inserted

Attributes

Throws
IllegalArgumentException

If the size of newBatch doesn't match the specified batch size

Abstract fields

protected val L: VectorD
protected val loss_per_epoch: VectorD
protected val n_mem: Int
protected val n_seq: Int
protected val n_var: Int
protected val seq_length: Int
protected val x: TensorD
protected val y: TensorD

Concrete fields

protected val CLASSIF: Boolean
protected val batch_size: Int
protected val eta: Double
protected val max_epochs: Int
protected val threshold: Double
protected val truncation_length: Int
protected val β: Double