Previous topic

Rolling models

Next topic

fynance.models.rolling._RollingBasis.__call__

fynance.models.rolling._RollingBasis

class fynance.models.rolling._RollingBasis(X, y, f=None, index=None)

Base object to roll a neural network model.

Rolling over a time axis with a train period from t - n to t and a testing period from t to t + s.

Parameters:
X, y : array_like

Respectively input and output data.

f : callable, optional

Function to transform target, e.g. torch.sign function.

index : array_like, optional

Time index of data.

Attributes:
n, s, r : int

Respectively size of training, testing and rolling period.

b, e, T : int

Respectively batch size, number of epochs and size of entire dataset.

t, _e, i : int

Respectively the current time period, the current epoch and the current iteration.

n_iter : int

The total number of iteration \(n_iter = e \times (T - t0 - s) \times r\).

y_eval, y_test : np.ndarray[ndim=1 or 2, dtype=np.float64]

Respectively evaluating (or training) and testing predictions.

Methods

__call__(train_period, test_period[, start, …]) Callable method to set target features data, and model.
run([backtest_plot, backtest_kpi, figsize, func]) Run neural network model and backtest predictions.