MCPcopy Create free account
hub / github.com/FinancialComputingUCL/LOBFrame / __init__

Method __init__

models/CNN2/cnn2.py:9–42  ·  view source on GitHub ↗
(self, num_features=40, num_classes=3, temp=249)

Source from the content-addressed store, hash-verified

7
8class CNN2(pl.LightningModule):
9 def __init__(self, num_features=40, num_classes=3, temp=249):
10 super().__init__()
11
12 # Convolution 1
13 self.conv1 = nn.Conv2d(in_channels=1, out_channels=16, kernel_size=(10, 42), padding=(0, 2))
14 self.bn1 = nn.BatchNorm2d(16)
15 self.prelu1 = nn.PReLU()
16
17 # Convolution 2
18 self.conv2 = nn.Conv1d(in_channels=16, out_channels=16, kernel_size=(10,)) # 3
19 self.bn2 = nn.BatchNorm1d(16)
20 self.prelu2 = nn.PReLU()
21
22 # Convolution 3
23 self.conv3 = nn.Conv1d(in_channels=16, out_channels=32, kernel_size=(8,)) # 1
24 self.bn3 = nn.BatchNorm1d(32)
25 self.prelu3 = nn.PReLU()
26
27 # Convolution 4
28 self.conv4 = nn.Conv1d(in_channels=32, out_channels=32, kernel_size=(6,)) # 1
29 self.bn4 = nn.BatchNorm1d(32)
30 self.prelu4 = nn.PReLU()
31
32 # Convolution 5
33 self.conv5 = nn.Conv1d(in_channels=32, out_channels=32, kernel_size=(4,)) # 1
34 self.bn5 = nn.BatchNorm1d(32)
35 self.prelu5 = nn.PReLU()
36
37 # Fully connected 1
38 self.fc1 = nn.Linear(temp*32, 32)
39 self.prelu6 = nn.PReLU()
40
41 # Fully connected 2
42 self.fc2 = nn.Linear(32, num_classes)
43
44 def forward(self, x):
45 # Convolution 1

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected