RNN

scalation.modeling.forecasting.neuralforecasting.RNN
See theRNN companion object
class RNN(x: MatrixD, y: MatrixD, fname: Array[String], n_mem: Int) extends FitM

The RNN class implements Recurrent Neural Network (RNN) via Back Propagation Through Time (BPTT). At each time point x_t, there is a vector representing several variables or the encoding of a word. Intended to work for guessing the next work in a sentence or for multi-horizon forecasting. Time series: (x_t: t = 0, 1, ..., n_seq-1) where n_seq is the number of time points/words

Value parameters

fname

the feature/variable names

n_mem

the size for hidden state (h) (dimensionality of memory)

x

the input sequence/time series

y

the output sequence/time series

Attributes

Companion
object
Graph
Supertypes
trait FitM
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def backward(batch_start: Int, batch_end: Int): Unit

Backward propagate to calculate gradients using chain rules in O(n_seq) time. FIX - add option of using sse loss function and fix affected partial derivatives

Backward propagate to calculate gradients using chain rules in O(n_seq) time. FIX - add option of using sse loss function and fix affected partial derivatives

Attributes

def forward(batch_start: Int, batch_end: Int): Unit

Forward propagate calculates yp, loss and intermediate variables for each step.

Forward propagate calculates yp, loss and intermediate variables for each step.

Attributes

def test(original_extremes: (Double, Double)): Unit

Test the RNN predictions.

Test the RNN predictions.

Attributes

def train(): Unit

Train the RNN using batch gradient descent. IN PROGRESS

Train the RNN using batch gradient descent. IN PROGRESS

Attributes

def update_params(batch_size: Int, leaky: Boolean): Unit

Based on the calculated partial derivatives, update the parameters (weights and biases). ^ @pram batch_size ^ @pram leaky

Based on the calculated partial derivatives, update the parameters (weights and biases). ^ @pram batch_size ^ @pram leaky

Attributes

Inherited methods

def diagnose(y: VectorD, yp: VectorD, w: VectorD): VectorD

Diagnose and return the health of the model by computing the Quality of Fit (QoF) metrics/measures, from the error/residual vector and the predicted & actual responses. For some models the instances may be weighted.

Diagnose and return the health of the model by computing the Quality of Fit (QoF) metrics/measures, from the error/residual vector and the predicted & actual responses. For some models the instances may be weighted.

Value parameters

w

the weights on the instances (defaults to null)

y

the actual response/output vector to use (test/full)

yp

the predicted response/output vector (test/full)

Attributes

See also

Regression_WLS Override to add more metrics.

Inherited from:
FitM
def fit: VectorD

Return the Quality of Fit (QoF) measures corresponding to the labels given. Note, if sse > sst, the model introduces errors and the rSq may be negative, otherwise, R^2 (rSq) ranges from 0 (weak) to 1 (strong). Override to add more quality of fit measures.

Return the Quality of Fit (QoF) measures corresponding to the labels given. Note, if sse > sst, the model introduces errors and the rSq may be negative, otherwise, R^2 (rSq) ranges from 0 (weak) to 1 (strong). Override to add more quality of fit measures.

Attributes

Inherited from:
FitM
def help: String

Return the help string that describes the Quality of Fit (QoF) metrics/measures.

Return the help string that describes the Quality of Fit (QoF) metrics/measures.

Attributes

See also

Fit for an implementation. Override to correspond to fitLabel.

Inherited from:
FitM
def rSq0_: Double

Attributes

Inherited from:
FitM
def rSq_: Double

Return the coefficient of determination (R^2). Must call diagnose first.

Return the coefficient of determination (R^2). Must call diagnose first.

Attributes

Inherited from:
FitM
inline def smapeF(y: VectorD, yp: VectorD, e_: VectorD): Double

Return the symmetric Mean Absolute Percentage Error (sMAPE) score. Caveat: y_i = yp_i = 0 => no error => no percentage error

Return the symmetric Mean Absolute Percentage Error (sMAPE) score. Caveat: y_i = yp_i = 0 => no error => no percentage error

Value parameters

e_

the error/residual vector (if null, recompute)

y

the given time-series (must be aligned with the forecast)

yp

the forecasted time-series

Attributes

Inherited from:
FitM
def sse_: Double

Return the sum of the squares for error (sse). Must call diagnose first.

Return the sum of the squares for error (sse). Must call diagnose first.

Attributes

Inherited from:
FitM
def summary(x_: MatrixD, fname: Array[String], b: VectorD, vifs: VectorD): String

Produce a QoF summary for a model with diagnostics for each predictor 'x_j' and the overall Quality of Fit (QoF).

Produce a QoF summary for a model with diagnostics for each predictor 'x_j' and the overall Quality of Fit (QoF).

Value parameters

b

the parameters/coefficients for the model

fname

the array of feature/variable names

vifs

the Variance Inflation Factors (VIFs)

x_

the testing/full data/input matrix

Attributes

Inherited from:
FitM