kangkangchen commited on
Commit
c9fc5f7
·
verified ·
1 Parent(s): 441286f

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +8 -8
  2. config.json +10 -10
  3. model.pt +2 -2
  4. model.py +15 -15
README.md CHANGED
@@ -30,7 +30,7 @@ Input: (batch, 100, 40) - 100 consecutive LOB snapshots
30
  ↓ 3-class Classification
31
  ```
32
 
33
- Parameters: 85,803
34
 
35
  ## 输出 / Output Classes
36
 
@@ -44,13 +44,13 @@ Parameters: 85,803
44
 
45
  | Metric | Value |
46
  |--------|-------|
47
- | Test Accuracy | 0.1579 |
48
- | Test F1 (Macro) | 0.1634 |
49
- | Test F1 (Weighted) | 0.0725 |
50
- | 主力买入 Precision | 0.1306 |
51
- | 主力买入 Recall | 0.4739 |
52
- | 主力卖出 Precision | 0.1876 |
53
- | 主力卖出 Recall | 0.5947 |
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": 85803,
11
  "class_names": [
12
  "主力买入 (Buy)",
13
  "中性 (Neutral)",
@@ -18,18 +18,18 @@
18
  "中性/散户",
19
  "主力卖出"
20
  ],
21
- "test_accuracy": 0.15789473684210525,
22
- "test_f1_macro": 0.16335941375062,
23
- "test_f1_weighted": 0.07250430112144952,
24
  "test_precision": [
25
- 0.13064361191162344,
26
- 0.0,
27
- 0.18763102725366876
28
  ],
29
  "test_recall": [
30
- 0.4738675958188153,
31
- 0.0,
32
- 0.5946843853820598
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:b8cba3876b1f6e97f0a5c424e4313e38fd8a83e5f5cb5550d2a0d55bd1d56feb
3
- size 366176
 
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=64, nhead=4, dropout=0.4):
20
  super().__init__()
21
  self.norm = BilinearNorm(40)
22
  self.spatial = nn.Sequential(
23
- nn.Conv2d(1, 16, kernel_size=(1, 2), stride=(1, 2)),
24
- nn.BatchNorm2d(16), nn.ReLU(), nn.Dropout2d(dropout * 0.5),
25
- nn.Conv2d(16, 16, kernel_size=(1, 2), stride=(1, 2)),
26
- nn.BatchNorm2d(16), nn.ReLU(), nn.Dropout2d(dropout * 0.5),
27
- nn.Conv2d(16, 16, kernel_size=(1, 10)),
28
- nn.BatchNorm2d(16), nn.ReLU(),
29
  )
30
  self.temporal = nn.Sequential(
31
- nn.Conv1d(16, 32, kernel_size=3, padding=1),
32
- nn.BatchNorm1d(32), nn.ReLU(), nn.Dropout(dropout),
33
- nn.Conv1d(32, 32, kernel_size=5, padding=2),
34
- nn.BatchNorm1d(32), nn.ReLU(), nn.Dropout(dropout),
35
- nn.Conv1d(32, d_model, kernel_size=3, padding=1),
36
- nn.BatchNorm1d(d_model), nn.ReLU(), nn.Dropout(dropout),
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, 32),
47
  nn.GELU(),
48
  nn.Dropout(dropout),
49
- nn.Linear(32, num_classes)
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)