--- library_name: transformers tags: - time-series - forecasting - patchtst - finance - probabilistic-forecasting datasets: - siddharthmb/stocks-ohlcv --- # PatchTST Cross-Sectional Return Forecast This model is a `PatchTSTForPrediction` model trained to forecast future cross-sectional stock return distributions. ## Data - Dataset: `siddharthmb/stocks-ohlcv` - Source file: `ohlcv.csv` - Tickers: `AAPL, MSFT, AMZN, GOOGL, NVDA, TSLA, AMD, INTC, ADBE, ORCL, CSCO, IBM, JPM, BAC, V, MA, AXP, JNJ, PG, KO` - Input: past daily log returns in percentage points - Target: future daily log returns in percentage points - Split: chronological train / validation / test ## Model ```python PatchTSTConfig( context_length=512, prediction_length=64, num_input_channels=20, patch_length=16, patch_stride=8, d_model=128, num_hidden_layers=4, num_attention_heads=4, distribution_output="student_t", loss="nll", scaling="std", ) ``` Student-t output is used because financial returns are heavy-tailed. ## Metrics Validation: ```json { "loss": 40.24222278594971, "mae": 3.3909754753112793, "mse": 15.027800559997559, "directional_accuracy": 0.5080167271784233, "flattened_ic": 0.002849485427271254, "cross_sectional_ic": 0.008907554652154311, "cross_sectional_rank_ic": 0.008295830343493587 } ``` Test: ```json { "loss": 38.46169090270996, "mae": 3.328381299972534, "mse": 14.407476425170898, "directional_accuracy": 0.534091938405797, "flattened_ic": 0.00037866420310066716, "cross_sectional_ic": 0.00456014569165105, "cross_sectional_rank_ic": 0.009876399072214697 } ``` NLL/loss is the primary metric because this is a probabilistic forecasting model. ## Intended Use Research and experimentation with probabilistic multi-asset return forecasting. This is not a production trading system or investment advice.