Previous topic

Rolling models

Next topic



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.

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.

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.


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