Upload folder using huggingface_hub
Browse files
README.md
CHANGED
|
@@ -30,7 +30,7 @@ Input: (batch, 100, 40) - 100 consecutive LOB snapshots
|
|
| 30 |
↓ 3-class Classification
|
| 31 |
```
|
| 32 |
|
| 33 |
-
Parameters:
|
| 34 |
|
| 35 |
## 输出 / Output Classes
|
| 36 |
|
|
@@ -44,13 +44,13 @@ Parameters: 85,803
|
|
| 44 |
|
| 45 |
| Metric | Value |
|
| 46 |
|--------|-------|
|
| 47 |
-
| Test Accuracy | 0.
|
| 48 |
-
| Test F1 (Macro) | 0.
|
| 49 |
-
| Test F1 (Weighted) | 0.
|
| 50 |
-
| 主力买入 Precision | 0.
|
| 51 |
-
| 主力买入 Recall | 0.
|
| 52 |
-
| 主力卖出 Precision | 0.
|
| 53 |
-
| 主力卖出 Recall | 0.
|
| 54 |
|
| 55 |
## 使用方法 / Usage
|
| 56 |
|
|
|
|
| 30 |
↓ 3-class Classification
|
| 31 |
```
|
| 32 |
|
| 33 |
+
Parameters: 338,395
|
| 34 |
|
| 35 |
## 输出 / Output Classes
|
| 36 |
|
|
|
|
| 44 |
|
| 45 |
| Metric | Value |
|
| 46 |
|--------|-------|
|
| 47 |
+
| Test Accuracy | 0.3980 |
|
| 48 |
+
| Test F1 (Macro) | 0.3795 |
|
| 49 |
+
| Test F1 (Weighted) | 0.4203 |
|
| 50 |
+
| 主力买入 Precision | 0.2418 |
|
| 51 |
+
| 主力买入 Recall | 0.5401 |
|
| 52 |
+
| 主力卖出 Precision | 0.2448 |
|
| 53 |
+
| 主力卖出 Recall | 0.6246 |
|
| 54 |
|
| 55 |
## 使用方法 / Usage
|
| 56 |
|
config.json
CHANGED
|
@@ -7,7 +7,7 @@
|
|
| 7 |
"d_model": 64,
|
| 8 |
"nhead": 4,
|
| 9 |
"dropout": 0.4,
|
| 10 |
-
"total_parameters":
|
| 11 |
"class_names": [
|
| 12 |
"主力买入 (Buy)",
|
| 13 |
"中性 (Neutral)",
|
|
@@ -18,18 +18,18 @@
|
|
| 18 |
"中性/散户",
|
| 19 |
"主力卖出"
|
| 20 |
],
|
| 21 |
-
"test_accuracy": 0.
|
| 22 |
-
"test_f1_macro": 0.
|
| 23 |
-
"test_f1_weighted": 0.
|
| 24 |
"test_precision": [
|
| 25 |
-
0.
|
| 26 |
-
0.
|
| 27 |
-
0.
|
| 28 |
],
|
| 29 |
"test_recall": [
|
| 30 |
-
0.
|
| 31 |
-
0.
|
| 32 |
-
0.
|
| 33 |
],
|
| 34 |
"training_dataset": "LeonardoBerti/TRADES-LOB",
|
| 35 |
"normalization": "z-score (means/stds in norm_stats.npz)",
|
|
|
|
| 7 |
"d_model": 64,
|
| 8 |
"nhead": 4,
|
| 9 |
"dropout": 0.4,
|
| 10 |
+
"total_parameters": 338395,
|
| 11 |
"class_names": [
|
| 12 |
"主力买入 (Buy)",
|
| 13 |
"中性 (Neutral)",
|
|
|
|
| 18 |
"中性/散户",
|
| 19 |
"主力卖出"
|
| 20 |
],
|
| 21 |
+
"test_accuracy": 0.3979949874686717,
|
| 22 |
+
"test_f1_macro": 0.37945545254276664,
|
| 23 |
+
"test_f1_weighted": 0.4203155400216087,
|
| 24 |
"test_precision": [
|
| 25 |
+
0.24180967238689546,
|
| 26 |
+
0.7696245733788396,
|
| 27 |
+
0.24479166666666666
|
| 28 |
],
|
| 29 |
"test_recall": [
|
| 30 |
+
0.5400696864111498,
|
| 31 |
+
0.3205401563610519,
|
| 32 |
+
0.6245847176079734
|
| 33 |
],
|
| 34 |
"training_dataset": "LeonardoBerti/TRADES-LOB",
|
| 35 |
"normalization": "z-score (means/stds in norm_stats.npz)",
|
model.pt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:af087d34c5d65978edcad41f0dd607b51b6a937a55de3ac73a0f194ed0029b91
|
| 3 |
+
size 1377888
|
model.py
CHANGED
|
@@ -16,24 +16,24 @@ class BilinearNorm(nn.Module):
|
|
| 16 |
return gate * (self.gamma * x_norm + self.beta) + (1 - gate) * x
|
| 17 |
|
| 18 |
class LOBPatternNetV3(nn.Module):
|
| 19 |
-
def __init__(self, num_classes=3, d_model=
|
| 20 |
super().__init__()
|
| 21 |
self.norm = BilinearNorm(40)
|
| 22 |
self.spatial = nn.Sequential(
|
| 23 |
-
nn.Conv2d(1,
|
| 24 |
-
nn.BatchNorm2d(
|
| 25 |
-
nn.Conv2d(
|
| 26 |
-
nn.BatchNorm2d(
|
| 27 |
-
nn.Conv2d(
|
| 28 |
-
nn.BatchNorm2d(
|
| 29 |
)
|
| 30 |
self.temporal = nn.Sequential(
|
| 31 |
-
nn.Conv1d(
|
| 32 |
-
nn.BatchNorm1d(
|
| 33 |
-
nn.Conv1d(
|
| 34 |
-
nn.BatchNorm1d(
|
| 35 |
-
nn.Conv1d(
|
| 36 |
-
nn.BatchNorm1d(d_model), nn.
|
| 37 |
)
|
| 38 |
encoder_layer = nn.TransformerEncoderLayer(
|
| 39 |
d_model=d_model, nhead=nhead, dim_feedforward=d_model*2,
|
|
@@ -43,10 +43,10 @@ class LOBPatternNetV3(nn.Module):
|
|
| 43 |
self.classifier = nn.Sequential(
|
| 44 |
nn.LayerNorm(d_model),
|
| 45 |
nn.Dropout(dropout),
|
| 46 |
-
nn.Linear(d_model,
|
| 47 |
nn.GELU(),
|
| 48 |
nn.Dropout(dropout),
|
| 49 |
-
nn.Linear(
|
| 50 |
)
|
| 51 |
def forward(self, x):
|
| 52 |
x = self.norm(x)
|
|
|
|
| 16 |
return gate * (self.gamma * x_norm + self.beta) + (1 - gate) * x
|
| 17 |
|
| 18 |
class LOBPatternNetV3(nn.Module):
|
| 19 |
+
def __init__(self, num_classes=3, d_model=128, nhead=4, dropout=0.25):
|
| 20 |
super().__init__()
|
| 21 |
self.norm = BilinearNorm(40)
|
| 22 |
self.spatial = nn.Sequential(
|
| 23 |
+
nn.Conv2d(1, 32, kernel_size=(1, 2), stride=(1, 2)),
|
| 24 |
+
nn.BatchNorm2d(32), nn.LeakyReLU(0.01),
|
| 25 |
+
nn.Conv2d(32, 32, kernel_size=(1, 2), stride=(1, 2)),
|
| 26 |
+
nn.BatchNorm2d(32), nn.LeakyReLU(0.01),
|
| 27 |
+
nn.Conv2d(32, 32, kernel_size=(1, 10)),
|
| 28 |
+
nn.BatchNorm2d(32), nn.LeakyReLU(0.01),
|
| 29 |
)
|
| 30 |
self.temporal = nn.Sequential(
|
| 31 |
+
nn.Conv1d(32, 64, kernel_size=3, padding=1),
|
| 32 |
+
nn.BatchNorm1d(64), nn.LeakyReLU(0.01), nn.Dropout(dropout),
|
| 33 |
+
nn.Conv1d(64, 64, kernel_size=5, padding=2),
|
| 34 |
+
nn.BatchNorm1d(64), nn.LeakyReLU(0.01), nn.Dropout(dropout),
|
| 35 |
+
nn.Conv1d(64, d_model, kernel_size=3, padding=1),
|
| 36 |
+
nn.BatchNorm1d(d_model), nn.LeakyReLU(0.01), nn.Dropout(dropout),
|
| 37 |
)
|
| 38 |
encoder_layer = nn.TransformerEncoderLayer(
|
| 39 |
d_model=d_model, nhead=nhead, dim_feedforward=d_model*2,
|
|
|
|
| 43 |
self.classifier = nn.Sequential(
|
| 44 |
nn.LayerNorm(d_model),
|
| 45 |
nn.Dropout(dropout),
|
| 46 |
+
nn.Linear(d_model, 64),
|
| 47 |
nn.GELU(),
|
| 48 |
nn.Dropout(dropout),
|
| 49 |
+
nn.Linear(64, num_classes)
|
| 50 |
)
|
| 51 |
def forward(self, x):
|
| 52 |
x = self.norm(x)
|