MSTNN: Temporal Network with Time‑Hyperedge for Stock Trend Prediction
Existing stock trend prediction models overlook periodic patterns and high‑order inter‑stock relations, so the authors propose MSTNN—a framework combining a 3D multi‑scale CNN to capture yearly, monthly, and daily cycles with a time‑hyperedge attention module, achieving state‑of‑the‑art accuracy and profitability on NASDAQ and NYSE benchmarks.
Background Stock trend prediction (STP) is crucial for profitable investment decisions. Traditional time‑series modeling techniques such as ARIMA, RNNs, and Transformers struggle to capture inherent periodicities (weekly, monthly, yearly) and ignore high‑order relationships among stocks within the same industry.
Problem Definition Existing STP methods treat each stock independently and miss important cyclical patterns and inter‑stock temporal dynamics that can provide contextual market information.
Method
The proposed MSTNN framework consists of two key components:
3D Multi‑Scale Convolutional Neural Network (3D‑MCNN) – builds a 3D tensor \(X_i\) (year \(Y=3\) × month \(M=12\) × day \(D=30\)) for each stock \(s_i\) to learn periodic features. The convolution operation produces a \(d\)-dimensional vector \(f_p^i\) using kernels of different sizes (\(W_1\) and \(W_2\)). The output \(F_p\) aggregates features for all \(N\) stocks.
Time Hypergraph Attention Network (THAN) – extends HyperGAT by aggregating time‑hyperedge features. It includes three stages: node aggregation, time‑hyperedge feature learning, and node representation learning via hyperedge aggregation (HA). Attention coefficients \(\alpha_{v_{jk}}\) weight the contribution of each hyperedge to a node.
3.1 3D‑MCNN identifies yearly, monthly, and daily cycles in closing prices. For a stock \(s_i\), the feature learning equation is:
3.2 Time Hypergraph Attention Network
3.2.1 Node Aggregation learns hyperedge features \(e_j^l\) from 3D‑MCNN outputs:
where \(h_{k}^{l-1}\) is the embedding of node \(v_k\) in hyperedge \(e_j\), \(\sigma\) denotes a non‑linear activation (e.g., LeakyReLU), and \(\alpha_{v_{jk}}\) is the attention coefficient matrix.
3.2.2 Time Hyperedge Feature Learning treats each hyperedge as a time series over \(T\) days, forming a feature tensor \(e\). Position encoding \(PE\) and periodic position encoding \(PPE\) are applied:
3.2.3 Node Representation Learning via Hyperedge Aggregation (HA) aggregates hyperedge representations \(f_j^l\) to obtain node embeddings \(h\) across multiple heads, and averages over the second dimension to produce the final stock representation \(r\):
3.3 Stock Trend Prediction The final representation \(r_t^i\) is transformed into a probability \(\hat{y}_t^i\) of price increase using a learnable weight vector \(w\). The model is optimized with binary cross‑entropy loss:
Experiments
4.1 Datasets Two real‑world datasets from the US market (NASDAQ and NYSE) are used, each containing 1,245 trading days from 2013‑01‑02 to 2017‑12‑08. Training uses 747 days, validation 249 days, and testing 249 days. Hypergraphs are constructed per industry, yielding 1,026 nodes & 113 hyperedges for NASDAQ and 1,737 nodes & 130 hyperedges for NYSE.
4.2 Baselines and Metrics Compared against three groups: (1) Time‑Series Deep Learning (LSTM, SFM, DARNN, Adv‑LSTM, Transformer); (2) Graph Neural Networks (GCN, TGC, HIST, LSR‑IGRU); (3) Hypergraph Neural Networks (STHGCN, HGTAN, Sthan‑sr, ESTIMATE). Evaluation metrics include accuracy, recall, precision, and F1‑score.
4.3 Results
Prediction Performance MSTNN achieves the best scores on all metrics for both datasets. On NASDAQ, its F1‑score improves by 6.64 % over ESTIMATE (HGNN) and 19.4 % over Adv‑LSTM (TSDL).
Profitability Comparison Using a daily buy‑hold simulation on the NASDAQ test set, MSTNN’s cumulative investment return ratio (CIRR) reaches 37.12 % by the final trading day, 7.77 % higher than the second‑best Sthan‑sr, demonstrating superior long‑term profitability.
Ablation Study Removing any component (3D‑MCNN, THAN, or HA) degrades performance on both datasets, confirming the effectiveness of each module.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
