Download src/models/model_linear.py from GoldenGrapeGentleman1/FinMM-Project-FinMM: direct link, hf CLI and curl.
- Browser
- Download file 604 Bytes
-
https://huggingface.co/GoldenGrapeGentleman1/FinMM-Project-FinMM/resolve/main/src/models/model_linear.py
- Command line
-
hf download hf://GoldenGrapeGentleman1/FinMM-Project-FinMM/src/models/model_linear.py
-
curl -L -o model_linear.py https://huggingface.co/GoldenGrapeGentleman1/FinMM-Project-FinMM/resolve/main/src/models/model_linear.py
604 Bytes
| import torch | |
| import torch.nn as nn | |
| class LinearBaseline(nn.Module): | |
| """ | |
| Linear Baseline Model: Simple linear mapping. | |
| """ | |
| def __init__(self, configs): | |
| super().__init__() | |
| self.pred_len = configs.pred_len | |
| self.channels = configs.c_in | |
| # Simple linear predictor | |
| self.linear = nn.Linear(configs.history_len, configs.pred_len) | |
| def forward(self, x): | |
| # x: [B, SeqLen, C] -> [B, C, SeqLen] -> [B, C, PredLen] -> [B, PredLen, C] | |
| x = x.permute(0, 2, 1) | |
| out = self.linear(x) | |
| out = out.permute(0, 2, 1) | |
| return out | |