quantlab.model.predefined.tcn.TCNRegressor#

class quantlab.model.predefined.tcn.TCNRegressor(config)[source]#

Bases: QlibSequenceHead

Qlib’s TCN benchmark model on (bar, symbol) samples.

TCNNet trained by Qlib’s time-series regimen (QlibSequenceHead: CSRankNorm target, MSE, Adam, gradient values clipped at 3, the best validation epoch kept). Hyperparameters, with Qlib’s Alpha158 benchmark values (workflow_config_tcn_Alpha158.yaml) as defaults: window_bars (20), n_chans (32), num_layers (5), kernel_size (7), dropout (0.5), batch_size (2000), lr (1e-4), weight_decay (0.0), epochs (200) and early_stop (20).

Known differences from Qlib’s implementation: as LSTMRegressor’s (the model’s own factors, clip and zero fill instead of a fitted RobustZScoreNorm and window fill, a per-bar validation loss, one output column per label).

Parameters:
configModelConfig

Factors, labels, dates and hyperparameters.

Examples

>>> TCNRegressor(config).collect().train().name
'TCNRegressor_total.pth'
DEFAULTS = {'batch_size': 2000, 'dropout': 0.5, 'early_stop': 20, 'epochs': 200, 'kernel_size': 7, 'lr': 0.0001, 'n_chans': 32, 'num_layers': 5, 'weight_decay': 0.0, 'window_bars': 20}#

Every unset hyperparameter’s value; a head gives Qlib’s benchmark values.